]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
itest: fix result of string compares
authorWolfgang Denk <wd@denx.de>
Tue, 8 Feb 2011 15:56:05 +0000 (16:56 +0100)
committerWolfgang Denk <wd@denx.de>
Tue, 15 Feb 2011 20:45:55 +0000 (21:45 +0100)
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 <wd@denx.de>
Acked-by: Detlev Zundel <dzu@denx.de>
common/cmd_itest.c

index fa6a0c30113216df21d96e5bb3075cf9a849d5aa..2a238a43e5d13e56db36665562162eee5e512705 100644 (file)
@@ -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);