summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/libc/string0.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shared/libc/string0.c b/shared/libc/string0.c
index a3b268e44..3909f70ed 100644
--- a/shared/libc/string0.c
+++ b/shared/libc/string0.c
@@ -154,7 +154,7 @@ int strcmp(const char *s1, const char *s2) {
}
int strncmp(const char *s1, const char *s2, size_t n) {
- while (*s1 && *s2 && n > 0) {
+ while (n > 0 && *s1 && *s2) {
char c1 = *s1++; // XXX UTF8 get char, next char
char c2 = *s2++; // XXX UTF8 get char, next char
n--;