From 536582bf89bb97eb3636e41470f303877a738810 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 18 Feb 2008 20:26:32 +0100 Subject: [PATCH] Exit on bad command line options It could be dangerous, eg if you expected --read-only to do its job when you really needed to type --readonly. Signed-off-by: Jens Axboe --- init.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init.c b/init.c index f5dff505..e96b4102 100644 --- a/init.c +++ b/init.c @@ -837,7 +837,7 @@ static void set_debug(const char *string) static int parse_cmd_line(int argc, char *argv[]) { struct thread_data *td = NULL; - int c, ini_idx = 0, lidx, ret, dont_add_job = 0; + int c, ini_idx = 0, lidx, ret, dont_add_job = 0, bad_options = 0; while ((c = getopt_long_only(argc, argv, "", long_options, &lidx)) != -1) { switch (c) { @@ -914,10 +914,14 @@ static int parse_cmd_line(int argc, char *argv[]) break; } default: + bad_options++; break; } } + if (bad_options) + exit(1); + if (td) { if (dont_add_job) put_job(td); -- 2.25.1