[PATCH 1/3] commands/test: Bail out on incomplete command line options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 commands/test.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/commands/test.c b/commands/test.c
index c4f493860f14..ab108fc845d5 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)
-- 
2.24.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux