From a0d0470f4925c950f484fd607a5382978c8d999d Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Mon, 12 Dec 1994 01:23:33 +0000 Subject: [PATCH] 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. --- lib/libc/string/memccpy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libc/string/memccpy.c b/lib/libc/string/memccpy.c index 878e41919cbc..c457110b62d3 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);