diff options
author | Denys Vlasenko | 2009-08-02 20:18:29 +0200 |
---|---|---|
committer | Denys Vlasenko | 2009-08-02 20:18:29 +0200 |
commit | 4cd4eb43320de6ecccb3b69087daee325d0bbfc1 (patch) | |
tree | 44db952d0feea229c4359bd5a2f8dc59db5ee07d /coreutils/test.c | |
parent | 6a98f95373d60d48001299797f52b1f19c7ffecd (diff) | |
download | busybox-4cd4eb43320de6ecccb3b69087daee325d0bbfc1.zip busybox-4cd4eb43320de6ecccb3b69087daee325d0bbfc1.tar.gz |
apply post-1.14.2 patches
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/test.c')
-rw-r--r-- | coreutils/test.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/coreutils/test.c b/coreutils/test.c index ae40192..ab7b416 100644 --- a/coreutils/test.c +++ b/coreutils/test.c @@ -571,7 +571,14 @@ static number_t nexpr(enum token n) nest_msg(">nexpr(%s)\n", TOKSTR[n]); if (n == UNOT) { - res = !nexpr(check_operator(*++args)); + n = check_operator(*++args); + if (n == EOI) { + /* special case: [ ! ], [ a -a ! ] are valid */ + /* IOW, "! ARG" may miss ARG */ + unnest_msg("<nexpr:1 (!EOI)\n"); + return 1; + } + res = !nexpr(n); unnest_msg("<nexpr:%lld\n", res); return res; } @@ -742,7 +749,7 @@ int test_main(int argc, char **argv) check_operator(argv[1]); if (last_operator->op_type == BINOP) { /* "test [!] arg1 <binary_op> arg2" */ - args = &argv[0]; + args = argv; res = (binop() == 0); goto ret; } @@ -755,7 +762,7 @@ int test_main(int argc, char **argv) argv--; } #endif - args = &argv[0]; + args = argv; res = !oexpr(check_operator(*args)); if (*args != NULL && *++args != NULL) { |