diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-02-21 15:39:07 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-02-21 15:39:07 +0000 |
commit | 1999031e0438e50a8037d2e3022a55c4db94637a (patch) | |
tree | bcc41208d3d12f040cccea381f8ab94196f7a712 | |
parent | b85b1334458711657a4cbea0bf2954936d67a4a4 (diff) | |
download | glibc-1999031e0438e50a8037d2e3022a55c4db94637a.tar.gz glibc-1999031e0438e50a8037d2e3022a55c4db94637a.tar.xz glibc-1999031e0438e50a8037d2e3022a55c4db94637a.zip |
Update.
2001-02-21 Ulrich Drepper <drepper@redhat.com> * sysdeps/i386/i686/strtok.S: Continue to return NULL after the first time this happened. 2001-02-21 Andreas Jaeger <aj@suse.de> * string/tst-strtok.c: New testcase, reported by Andrew Church <achurch@achurch.org>.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | string/tst-strtok.c | 23 | ||||
-rw-r--r-- | sysdeps/i386/i686/strtok.S | 4 |
3 files changed, 36 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index 9b9f2e945c..c09932b8af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-02-21 Ulrich Drepper <drepper@redhat.com> + + * sysdeps/i386/i686/strtok.S: Continue to return NULL after the + first time this happened. + +2001-02-21 Andreas Jaeger <aj@suse.de> + + * string/tst-strtok.c: New testcase, reported by + Andrew Church <achurch@achurch.org>. + 2001-02-20 Ulrich Drepper <drepper@redhat.com> * libio/iofwide.c: Remove fwide alias. diff --git a/string/tst-strtok.c b/string/tst-strtok.c new file mode 100644 index 0000000000..ed3400d820 --- /dev/null +++ b/string/tst-strtok.c @@ -0,0 +1,23 @@ +/* Testcase for strtok reported by Andrew Church <achurch@achurch.org>. */ +#include <stdio.h> +#include <string.h> + +int +main (void) +{ + char buf[1] = { 0 }; + int result = 0; + + if (strtok (buf, " ") != NULL) + { + puts ("first strtok call did return NULL"); + result = 1; + } + else if (strtok (NULL, " ") != NULL) + { + puts ("second strtok call did return NULL"); + result = 1; + } + + return result; +} diff --git a/sysdeps/i386/i686/strtok.S b/sysdeps/i386/i686/strtok.S index a982a4aa49..e21b5f65e6 100644 --- a/sysdeps/i386/i686/strtok.S +++ b/sysdeps/i386/i686/strtok.S @@ -1,6 +1,6 @@ /* strtok (str, delim) -- Return next DELIM separated token from STR. For Intel 80686. - Copyright (C) 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -123,6 +123,8 @@ ENTRY (BP_SYM (FUNCTION)) the last run. */ cmpl $0, %edx cmove %eax, %edx + testl %edx, %edx + jz L(returnNULL) #if __BOUNDED_POINTERS__ # ifdef USE_AS_STRTOK_R movl SAVE(%esp), %ecx /* borrow %ecx for a moment */ |