From 34c687e6fac3f9d47bc44c8e390e73c18e1c7ad0 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 3 Feb 2014 13:21:05 -0700 Subject: [PATCH] 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 --- common/cmd_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/cmd_test.c b/common/cmd_test.c index 0149d7edf..f1b15c9a7 100644 --- a/common/cmd_test.c +++ b/common/cmd_test.c @@ -93,7 +93,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; -- 2.34.1