A patch for ./sysdeps/generic/strtok.c
H . J . Lu
hjl@valinux.com
Thu Feb 22 17:09:00 GMT 2001
The new strtok testcase exposed a bug in sysdeps/generic/strtok.c. Here
is a patch. But it may not be the best one.
--
H.J. Lu (hjl@valinux.com)
--
2001-02-22 H.J. Lu <hjl@gnu.org>
* sysdeps/generic/strtok.c (strtok): Return NULL if `s' is
NULL.
Index: sysdeps/generic/strtok.c
===================================================================
RCS file: /work/cvs/gnu/glibc/sysdeps/generic/strtok.c,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 strtok.c
--- sysdeps/generic/strtok.c 2000/08/16 00:57:41 1.1.1.2
+++ sysdeps/generic/strtok.c 2001/02/23 01:03:03
@@ -42,6 +42,9 @@ strtok (s, delim)
if (s == NULL)
s = olds;
+ if (s == NULL)
+ return NULL;
+
/* Scan leading delimiters. */
s += strspn (s, delim);
if (*s == '\0')
More information about the Libc-alpha
mailing list