From: Sebastian Harl Date: Wed, 10 Dec 2008 21:08:26 +0000 (+0100) Subject: collectd: Abort if any non-options are left over after command-line parsing. X-Git-Tag: collectd-4.4.5~7 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=bb3e4316a30349bdbdf98fcfce521b11a7b7d7d4;hp=9b031e21c5d0200c2c07c70a592158d29c522391;p=collectd.git collectd: Abort if any non-options are left over after command-line parsing. This happens if any arguments not starting with a dash are passed to collectd. Any of those are invalid, so let the user know about that. Thanks to Kris (gruntruk) for (unknowingly) pointing that out ;-) --- diff --git a/src/collectd.c b/src/collectd.c index a3f63b48..e8aaed2b 100644 --- a/src/collectd.c +++ b/src/collectd.c @@ -443,6 +443,9 @@ int main (int argc, char **argv) } /* switch (c) */ } /* while (1) */ + if (optind < argc) + exit_usage (); + /* * Read options from the config file, the environment and the command * line (in that order, with later options overwriting previous ones in