aboutsummaryrefslogtreecommitdiffstats
path: root/src/wchar
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-10-13 12:50:28 +0200
committerMattias Andrée <maandree@operamail.com>2015-10-13 12:50:28 +0200
commitbe649f03b3702f6d338c4c065a349fcbf3e5ae35 (patch)
tree78d1f483268a05e5830cf9b54527f7c1e3e28cdf /src/wchar
parentinfo: assertions (diff)
downloadslibc-be649f03b3702f6d338c4c065a349fcbf3e5ae35.tar.gz
slibc-be649f03b3702f6d338c4c065a349fcbf3e5ae35.tar.bz2
slibc-be649f03b3702f6d338c4c065a349fcbf3e5ae35.tar.xz
fix strrchr bug, return the end of the string if c is 0
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/wchar')
-rw-r--r--src/wchar/wcschr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wchar/wcschr.c b/src/wchar/wcschr.c
index 16ecac2..9b87167 100644
--- a/src/wchar/wcschr.c
+++ b/src/wchar/wcschr.c
@@ -151,6 +151,6 @@ wchar_t* wcsrchr(const wchar_t* string, wchar_t c)
if (*string == c)
r = string;
else if (!*string++)
- return r;
+ return c ? r : (string - 1);
}