diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2020-01-28 14:07:59 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-02-10 09:42:43 +0100 |
commit | 6e7f99f26673e932a7c6e45a31727d4a82dd2c8c (patch) | |
tree | 1719deeba5c2463ba0aa92c62c39ee49ff477fab | |
parent | dc71db1369eeb7f383082c9ad38aa682c2a97c00 (diff) | |
download | barebox-6e7f99f26673e932a7c6e45a31727d4a82dd2c8c.tar.gz barebox-6e7f99f26673e932a7c6e45a31727d4a82dd2c8c.tar.xz |
commands/test: Bail out on incomplete command line options
This makes test emit an error (and fail) on e.g.
test -f
and also on unimplemented options like
test -c /dev/null
.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | commands/test.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/commands/test.c b/commands/test.c index c4f493860f..ab108fc845 100644 --- a/commands/test.c +++ b/commands/test.c @@ -208,6 +208,11 @@ static int do_test(int argc, char *argv[]) } } + if (left < adv) { + printf("test: failed to parse arguments\n"); + return 1; + } + if (last_cmp == 0) expr = last_expr || expr; else if (last_cmp == 1) |