diff options
Diffstat (limited to 'libc/include')
-rw-r--r-- | libc/include/string.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libc/include/string.h b/libc/include/string.h index 2ec2a84..cd58681 100644 --- a/libc/include/string.h +++ b/libc/include/string.h @@ -79,9 +79,11 @@ static inline char * strncpy(char * s1, const char * s2, size_t n) { } static inline const char * strchr(const char * s, char c) { - while (*s) - if (*s++ == c) + while (*s) { + if (*s == c) return s; + s++; + } return NULL; } |