ref: c68d4e43cd22c18199c1b5ea7468e3d9b5b2ad97
parent: 59eb8445113a831ac3edd6a42bc39438536db5da
author: Quentin Rameau <[email protected]>
date: Fri Feb 17 07:26:07 EST 2017
[libc] Fix memcmp return value
--- a/libc/src/memcmp.c
+++ b/libc/src/memcmp.c
@@ -7,7 +7,7 @@
{
char *s = (char *) s1, *t = (char *) s2;
- while (n > 0 && *s++ != *t++)
- --n;
- return n != 0;
+ while (n > 0 && *s == *t)
+ --n, ++s, ++t;
+ return n ? (*s - *t) : 0;
}