summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm <>2008-08-23 05:34:36 +0000
committerdjm <>2008-08-23 05:34:36 +0000
commitd6b49357a23bf3b25d553524944d17a6d109a9c6 (patch)
treeb68628a2a4572859fe301dc8508a1511c83f742e
parentf77577b586a3b656d0d3fd7cd01ec0fa114cd116 (diff)
downloadopenbsd-d6b49357a23bf3b25d553524944d17a6d109a9c6.tar.gz
openbsd-d6b49357a23bf3b25d553524944d17a6d109a9c6.tar.bz2
openbsd-d6b49357a23bf3b25d553524944d17a6d109a9c6.zip
unbreak wcschr(string, L'\0') which was incorrectly returning NULL
rather than a pointer to the terminating nul; ok deraadt@
-rw-r--r--src/lib/libc/string/wcschr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libc/string/wcschr.c b/src/lib/libc/string/wcschr.c
index c06127e087..b84a2d32e3 100644
--- a/src/lib/libc/string/wcschr.c
+++ b/src/lib/libc/string/wcschr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: wcschr.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: wcschr.c,v 1.4 2008/08/23 05:34:36 djm Exp $ */
2/* $NetBSD: wcschr.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */ 2/* $NetBSD: wcschr.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */
3 3
4/*- 4/*-
@@ -37,12 +37,14 @@ wcschr(const wchar_t *s, wchar_t c)
37 const wchar_t *p; 37 const wchar_t *p;
38 38
39 p = s; 39 p = s;
40 while (*p) { 40 for (;;) {
41 if (*p == c) { 41 if (*p == c) {
42 /* LINTED interface specification */ 42 /* LINTED interface specification */
43 return (wchar_t *)p; 43 return (wchar_t *)p;
44 } 44 }
45 if (!*p)
46 return NULL;
45 p++; 47 p++;
46 } 48 }
47 return NULL; 49 /* NOTREACHED */
48} 50}