This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
strtok bug
- To: libc-alpha at sourceware dot cygnus dot com
- Subject: strtok bug
- From: Clifford Wolf <clifford at clifford dot at>
- Date: Thu, 13 Jan 2000 12:56:54 +0100 (CET)
Hi,
I'm currently porting ROCK Linux (www.rocklinux.org) to the PPC
architecture. When porting telnetd (and some other packages) I found
the following bug which doesn't seam to be architecture depended but
only happens on PPC for me. Here is an example program:
--snip--
#include <string.h>
int main() {
strtok("",":"); /* returns NULL */
strtok(NULL,":"); /* should return NULL - but dups core on ppc */
}
--snip--
This works fine on intel and alpha - but it dumps core
on ppc. I don't have an explenation why it works on intel
and alpha ....
The following patch should fix the problem (I'm currently rebuilding
glibc an the iMac - so I will test it in aprox 5 hours ;-).
--snip--
--- glibc-2.1.2/sysdeps/generic/strtok.c~ Tue May 4 01:47:45 1999
+++ glibc-2.1.2/sysdeps/generic/strtok.c Thu Jan 13 13:42:45 2000
@@ -45,7 +45,7 @@
/* Scan leading delimiters. */
s += strspn (s, delim);
if (*s == '\0')
- return NULL;
+ { olds=""; return NULL; }
/* Find the end of the token. */
token = s;
--snip--
yours,
- clifford
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
Clifford Wolf ............... www.clifford.at ICQ: 60702100
The ROCK Projects Workgoup .. www.rock-projects.com Tel: +43-699-10063494
The ROCK Linux Workgoup ..... www.rocklinux.org Fax: +43-2235-42788-4
The NTx Consulting Group .... www.ntx.at email: god@clifford.at