summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/string/strtok.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/string/strtok.c b/src/string/strtok.c
index c46a9556..b48bba18 100644
--- a/src/string/strtok.c
+++ b/src/string/strtok.c
@@ -5,12 +5,15 @@
char * strtok(char * restrict s1, const char * restrict s2)
{
- static char *current = 0;
+ static char *current = NULL;
static char **state = &current;
/* TODO */
SIGNAL_SAFE(0);
ASSERT_NONNULL(s2);
+ if (current == NULL && s1 == NULL) {
+ UNDEFINED("strtok() called with NULL input and no previous call");
+ }
/* nothing is copied, overlap is OK */
/*