This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

A patch for ./sysdeps/generic/strtok.c


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]