From: Stephen Warren Date: Mon, 3 Feb 2014 20:21:05 +0000 (-0700) Subject: cmd_test: evaluate to false without any arguments X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=2453de99df576fb907fe06cac58c628e3590833f;p=u-boot.git cmd_test: evaluate to false without any arguments This emulates bash: $ if test; then echo yes; else echo no; fi no Currently, the code sets expr = -1 in this case, which gets mapped to 0 (true) at the end of do_test() by the logical -> shell exit code conversion. Signed-off-by: Stephen Warren --- diff --git a/common/cmd_test.c b/common/cmd_test.c index b927d09eb3..4c2f967c6d 100644 --- a/common/cmd_test.c +++ b/common/cmd_test.c @@ -77,7 +77,7 @@ static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) left = argc - 1; ap = argv + 1; - expr = -1; + expr = 0; last_unop = OP_INVALID; last_binop = OP_INVALID; last_expr = -1;