summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-02-23 14:59:43 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-02-25 12:18:04 +0100
commitfc7add20e1b54e1b0d10c7457629507fb62d7d31 (patch)
tree2707bb10289e5d149ad8f63b2560887feb9b8a1a
parentf4a3123145b104fc1a6b7f17c299479a8f734918 (diff)
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.
-rw-r--r--openbsc/src/osmo-nitb/bsc_hack.c4
1 files changed, 3 insertions, 1 deletions
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;
}
}