aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/string/strtok.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libc/string/strtok.c b/libc/string/strtok.c
index 665c08d..aa42d77 100644
--- a/libc/string/strtok.c
+++ b/libc/string/strtok.c
@@ -18,8 +18,11 @@ strtok(char *src, const char *pattern)
static char *nxtTok;
char *retVal = NULL;
- if (!src)
+ if (!src) {
src = nxtTok;
+ if (!src)
+ return retVal;
+ }
while (*src) {
const char *pp = pattern;