This patch make it possible to run udev with the latest klibc.
One patch for the udev/Makefile to match the moved include/ dir. Another
one for klibc's string fuctions, that are causing segfaults:
strncpy.c: the while() gets n == -1 and memset() dies
strncat.c: cat's only strlen(dest) count of chars from src to dest
Thanks,
Kay
-------------- next part --------------
===== Makefile 1.169 vs edited ====--- 1.169/Makefile 2004-09-14 07:55:07 +02:00
+++ edited/Makefile 2004-09-17 18:47:26 +02:00
@@ -140,7 +140,7 @@
ifeq ($(strip $(USE_KLIBC)),true)
KLIBC_BASE = $(PWD)/klibc
KLIBC_DIR = $(KLIBC_BASE)/klibc
- INCLUDE_DIR := $(KLIBC_DIR)/include
+ INCLUDE_DIR := $(KLIBC_BASE)/include
LINUX_INCLUDE_DIR := $(KERNEL_DIR)/include
# LINUX_INCLUDE_DIR := $(KLIBC_BASE)/linux/include
include $(KLIBC_DIR)/arch/$(ARCH)/MCONFIG
@@ -155,7 +155,7 @@
$(OPTFLAGS) \
-D__KLIBC__ -fno-builtin-printf \
-I$(INCLUDE_DIR) \
- -I$(KLIBC_DIR)/arch/$(ARCH)/include \
+ -I$(INCLUDE_DIR)/arch/$(ARCH) \
-I$(INCLUDE_DIR)/bits$(BITSIZE) \
-I$(GCCINCDIR) \
-I$(LINUX_INCLUDE_DIR)
-------------- next part --------------
--- ../klibc-0.177/klibc/strncpy.c 2004-08-26 08:03:41.000000000 +0200
+++ klibc/klibc/strncpy.c 2004-09-17 19:07:28.936701652 +0200
@@ -10,7 +10,8 @@ char *strncpy(char *dst, const char *src
const char *p = src;
char ch;
- while ( n-- ) {
+ while (n) {
+ n--;
*q++ = ch = *p++;
if ( !ch )
break;
--- ../klibc-0.177/klibc/strncat.c 2004-08-26 08:03:41.000000000 +0200
+++ klibc/klibc/strncat.c 2004-09-17 21:02:33.004357774 +0200
@@ -8,13 +8,18 @@
char *strncat(char *dst, const char *src, size_t n)
{
char *q = strchr(dst, '\0');
+ const char *p = src;
+ char ch;
size_t nn = q-dst;
if ( __likely(nn <= n) )
- n = nn;
+ n -= nn;
- memcpy(q, src, n);
- q[n] = '\0';
+ while (n--) {
+ *q++ = ch = *p++;
+ if ( !ch )
+ break;
+ }
return dst;
}