From fc7add20e1b54e1b0d10c7457629507fb62d7d31 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 23 Feb 2016 14:59:43 +0100 Subject: osmo-nitb: be strict about cmdline args Abort upon unknown options and missing option arguments. This came to my attention while rewiring the -m and -M options: passing -M without argument would launch nitb with wrong configuration. So, rather exit immediately. If there are legacy options that should be ignored, they deserve an own 'case:' in the option switch. There are none that I'm aware of though. --- openbsc/src/osmo-nitb/bsc_hack.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'openbsc/src') diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c index a89300aca..bfc1b7165 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -187,7 +187,9 @@ static void handle_options(int argc, char **argv) rf_ctrl_path = optarg; break; default: - /* ignore */ + /* catch unknown options *as well as* missing arguments. */ + fprintf(stderr, "Error in command line options. Exiting.\n"); + exit(-1); break; } } -- cgit v1.2.3