From: Wolfgang Denk Date: Tue, 8 Feb 2011 15:56:05 +0000 (+0100) Subject: itest: fix result of string compares X-Git-Tag: v2011.03-rc2~57 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cc22b795fb5fee72bd567eec5d33a11e8b989086;p=u-boot itest: fix result of string compares The implementation of the string compare function of the "itest" command was weird, as only the length of the shortest argument was included in the compare, with the result that something like "itest.s abd == abddef" would return TRUE. Fix this. Signed-off-by: Wolfgang Denk Acked-by: Detlev Zundel --- diff --git a/common/cmd_itest.c b/common/cmd_itest.c index fa6a0c3011..2a238a43e5 100644 --- a/common/cmd_itest.c +++ b/common/cmd_itest.c @@ -94,16 +94,13 @@ static char * evalstr(char *s) static int stringcomp(char *s, char *t, int op) { - int n, p; + int p; char *l, *r; l = evalstr(s); r = evalstr(t); - /* we'll do a compare based on the length of the shortest string */ - n = min(strlen(l), strlen(r)); - - p = strncmp(l, r, n); + p = strcmp(l, r); switch (op) { case EQ: return (p == 0); case NE: return (p != 0);