linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* latest klibc for udev
@ 2004-09-17 19:11 Kay Sievers
  2004-09-18  0:31 ` [klibc] " H. Peter Anvin
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Kay Sievers @ 2004-09-17 19:11 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 337 bytes --]

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

[-- Attachment #2: udev-klibc-last-01.patch --]
[-- Type: text/plain, Size: 731 bytes --]

===== 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)

[-- Attachment #3: klibc-bug-01.patch --]
[-- Type: text/plain, Size: 816 bytes --]

--- ../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;
 }

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-09-29 18:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-17 19:11 latest klibc for udev Kay Sievers
2004-09-18  0:31 ` [klibc] " H. Peter Anvin
2004-09-18 21:44 ` Bob Barry
2004-09-19 20:18 ` Kevin P. Fleming
2004-09-20  7:23 ` Bob Barry
2004-09-20 14:51 ` Kevin P. Fleming
2004-09-24 12:48 ` Bob Barry
2004-09-29 14:31 ` [klibc] " Jürg Billeter
2004-09-29 18:25 ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).