linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: latest klibc for udev
Date: Fri, 17 Sep 2004 19:11:34 +0000	[thread overview]
Message-ID: <20040917191134.GA28506@vrfy.org> (raw)

[-- 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;
 }

             reply	other threads:[~2004-09-17 19:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-17 19:11 Kay Sievers [this message]
2004-09-18  0:31 ` [klibc] latest klibc for udev 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040917191134.GA28506@vrfy.org \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).