]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
main: fix handling of return value of builtin_run_command()
authorLothar Waßmann <LW@KARO-electronics.de>
Wed, 15 Jan 2014 10:15:43 +0000 (11:15 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 15 Jan 2014 10:15:43 +0000 (11:15 +0100)
run_command() incorrectly stops after the first command that returns a
zero return value because the return value of builtin_run_command() is
checked for '1' only as success indicator.

common/main.c

index e852989f738a1cf059519ba6eb5e00857159bad9..dd2b095e6b4d461074d97d9e5251c1bf59b8f359 100644 (file)
@@ -1439,10 +1439,10 @@ int run_command(const char *cmd, int flag)
         * builtin_run_command can return 0 or 1 for success, so clean up
         * its result.
         */
-       if (builtin_run_command(cmd, flag) != 1)
-               return 1;
+       if ((builtin_run_command(cmd, flag) & ~1) != 0)
+               return CMD_RET_FAILURE;
 
-       return 0;
+       return CMD_RET_SUCCESS;
 #else
        return parse_string_outer(cmd,
                        FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP);
@@ -1552,8 +1552,8 @@ int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                }
 
                if (run_command(arg, flag) != 0)
-                       return 1;
+                       return CMD_RET_FAILURE;
        }
-       return 0;
+       return CMD_RET_SUCCESS;
 }
 #endif