summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/strncmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/string/strncmp.c')
-rw-r--r--lib/libc/string/strncmp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/string/strncmp.c b/lib/libc/string/strncmp.c
index 5bc3d5e..46db3f9 100644
--- a/lib/libc/string/strncmp.c
+++ b/lib/libc/string/strncmp.c
@@ -39,8 +39,9 @@ int
strncmp(const char *s1, const char *s2, size_t n)
{
- if (n == 0)
+ if ((n == 0) | (s1 == s2))
return (0);
+
do {
if (*s1 != *s2++)
return (*(const unsigned char *)s1 -
OpenPOWER on IntegriCloud