Skip to content

Commit 103dd3f

Browse files
82marbagwipawel
authored andcommitted
string: fix strtok
After a call to `strtok`, the internal state is left to \0; this leads to returning NULL on the next call regardless of the string. Signed-off-by: Daniele Ahmed <ahmeddan amazon c;0m >
1 parent ae07d46 commit 103dd3f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

include/string.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ static inline char *strtok(char *s, const char *delim) {
292292
int ch;
293293

294294
if (NULL == s)
295-
s = lasts;
295+
s = lasts + 1;
296296

297297
do {
298298
if ((ch = *s++) == '\0')

0 commit comments

Comments
 (0)