summaryrefslogtreecommitdiffstats
path: root/lib/libc/string
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1994-12-12 01:23:33 +0000
committerbde <bde@FreeBSD.org>1994-12-12 01:23:33 +0000
commitf9bd31e5430250e2089d716355836256f2f2bf1d (patch)
tree9457e8b35606b093008e334f708fb5a66c64b1bc /lib/libc/string
parent85651f85dafb2ae149a7f6acb6589318c8639e00 (diff)
downloadFreeBSD-src-f9bd31e5430250e2089d716355836256f2f2bf1d.zip
FreeBSD-src-f9bd31e5430250e2089d716355836256f2f2bf1d.tar.gz
Obtained from: 386BSD-0.1 patchkit; also fixed in 1.1.5
Compare unsigned chars. Return the place after where the character was found and not the start of the string.
Diffstat (limited to 'lib/libc/string')
-rw-r--r--lib/libc/string/memccpy.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/string/memccpy.c b/lib/libc/string/memccpy.c
index 878e419..c457110 100644
--- a/lib/libc/string/memccpy.c
+++ b/lib/libc/string/memccpy.c
@@ -49,9 +49,10 @@ memccpy(t, f, c, n)
if (n) {
register unsigned char *tp = t;
register const unsigned char *fp = f;
+ register unsigned char uc = c;
do {
- if ((*tp++ = *fp++) == c)
- return (t);
+ if ((*tp++ = *fp++) == uc)
+ return (tp);
} while (--n != 0);
}
return (0);
OpenPOWER on IntegriCloud