Explorar o código

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 <swarren@nvidia.com>
Stephen Warren %!s(int64=11) %!d(string=hai) anos
pai
achega
2453de99df
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      common/cmd_test.c

+ 1 - 1
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;