From: John Hodge Date: Sun, 27 Sep 2009 10:12:46 +0000 (+0800) Subject: Fixed strncmp X-Git-Tag: rel0.06~428 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=71d97264ff059a530d86584f690a43831468dc69;p=tpg%2Facess2.git Fixed strncmp --- diff --git a/Kernel/lib.c b/Kernel/lib.c index c1063516..3399d3d8 100644 --- a/Kernel/lib.c +++ b/Kernel/lib.c @@ -141,7 +141,8 @@ int strcmp(char *str1, char *str2) */ int strncmp(char *Str1, char *Str2, size_t num) { - while(num-- && *Str1 && *Str1 == *Str2) + if(num == 0) return 0; // TODO: Check what should officially happen here + while(--num && *Str1 && *Str1 == *Str2) Str1++, Str2++; return *Str1-*Str2; }