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

From: <git_AT_suckless.org>
Date: Fri, 17 Feb 2017 10:52:56 +0100 (CET)

commit 4f362644a6603e1242956edef4d722fe525c2d29
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 10:51:36 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 - 10:52:56 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 17 2017 - 11:00:58 CET