[hackers] [scc] [libc] Fix strchr || Quentin Rameau

From: <git_AT_suckless.org>
Date: Fri, 17 Feb 2017 11:01:40 +0100 (CET)

commit 70675f32291a81492c2ebfbf8f5fe2cf827510a6
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Fri Feb 17 01:08:08 2017 +0100
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Fri Feb 17 11:00:33 2017 +0100

    [libc] Fix strchr
    
    Don't forget that the terminating NULL should be checked too.

diff --git a/libc/src/strchr.c b/libc/src/strchr.c
index 16aa47c..814708a 100644
--- a/libc/src/strchr.c
+++ b/libc/src/strchr.c
_AT_@ -7,5 +7,5 @@ strchr(const char *s, int c)
 {
         while (*s && *s != c)
                 ++s;
- return (*s) ? (char *) s : NULL;
+ return (*s == c) ? (char *)s : NULL;
 }
Received on Fri Feb 17 2017 - 11:01:40 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 17 2017 - 11:12:32 CET