summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrich cannings <richc@google.com>2010-08-31 15:48:25 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-08-31 15:48:25 -0700
commit6e42398dd66d1ec7d84257f78c07dcc7f29a2283 (patch)
treeaef330514edb08232783283562c5c3de393ac907
parentcc6b18291075a7960ad0d638d2047f41be1297e8 (diff)
parente44cb1a35c4bf3f30e2b9e3961c57b7ca6fa7849 (diff)
downloadbionic-6e42398dd66d1ec7d84257f78c07dcc7f29a2283.zip
bionic-6e42398dd66d1ec7d84257f78c07dcc7f29a2283.tar.gz
bionic-6e42398dd66d1ec7d84257f78c07dcc7f29a2283.tar.bz2
Merge "Fix return value." into gingerbread
-rw-r--r--libc/string/memccpy.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/libc/string/memccpy.c b/libc/string/memccpy.c
index 2689e80..789fde6 100644
--- a/libc/string/memccpy.c
+++ b/libc/string/memccpy.c
@@ -38,18 +38,9 @@ void *memccpy(void *dst, const void *src, int c, size_t n)
for (;;) {
if (ch == c || p >= p_end) break;
*q++ = ch = *p++;
-
- if (ch == c || p >= p_end) break;
- *q++ = ch = *p++;
-
- if (ch == c || p >= p_end) break;
- *q++ = ch = *p++;
-
- if (ch == c || p >= p_end) break;
- *q++ = ch = *p++;
}
- if (p >= p_end)
+ if (p >= p_end && ch != c)
return NULL;
return q;