From 6e7f99f26673e932a7c6e45a31727d4a82dd2c8c Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 28 Jan 2020 14:07:59 +0100 Subject: commands/test: Bail out on incomplete command line options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Sascha Hauer --- commands/test.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'commands') 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) -- cgit v1.2.3