summaryrefslogtreecommitdiff
path: root/sys/lib
diff options
context:
space:
mode:
authorrtr <rtr@NetBSD.org>2008-03-21 10:24:13 +0000
committerrtr <rtr@NetBSD.org>2008-03-21 10:24:13 +0000
commit16ebb0dc793ee2af53c88511bffcdced67f96abb (patch)
treec498ffbc4fcb934ad464e88599927a8212afa958 /sys/lib
parent435d63b60cc34bed8d77fff282d680a2b43593eb (diff)
when the char being searched for is not found strchr() must return NULL
not a pointer to the terminating '\0'. the only time we return a pointer to the terminating '\0' is when the char being searched for is '\0'. fixes problem observed booting -current install http://mail-index.netbsd.org/current-users/2008/03/20/msg001445.html
Diffstat (limited to 'sys/lib')
-rw-r--r--sys/lib/libsa/strchr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/lib/libsa/strchr.c b/sys/lib/libsa/strchr.c
index 75e5dafe8b2..e583b228ff9 100644
--- a/sys/lib/libsa/strchr.c
+++ b/sys/lib/libsa/strchr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: strchr.c,v 1.1 2008/03/14 22:27:32 dsl Exp $ */
+/* $NetBSD: strchr.c,v 1.2 2008/03/21 10:24:13 rtr Exp $ */
/*-
* Copyright (c) 2008, The NetBSD Foundation, Inc.
@@ -51,5 +51,9 @@ strchr(const char *s, int c)
while (*s != 0 && *s != ch)
s++;
+
+ if (*s != ch)
+ return NULL;
+
return __UNCONST(s);
}