From 0fbf39cc9f68159495142339408054d68b2bb7b4 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 15 Apr 2011 20:26:05 +0000 Subject: strchrnul: avoid segv * libc/string/strchrnul.c (strchrnul): Fix strchrnul. --- newlib/libc/string/strchrnul.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'newlib/libc/string/strchrnul.c') diff --git a/newlib/libc/string/strchrnul.c b/newlib/libc/string/strchrnul.c index 59c7311b9..afeef434e 100644 --- a/newlib/libc/string/strchrnul.c +++ b/newlib/libc/string/strchrnul.c @@ -43,7 +43,5 @@ _DEFUN (strchrnul, (s1, i), { char *s = strchr(s1, i); - if (*s != NULL) - return s; - return (char *)s1 + strlen(s1); + return s ? s : (char *)s1 + strlen(s1); } -- cgit v1.2.3