From bb3e4316a30349bdbdf98fcfce521b11a7b7d7d4 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 10 Dec 2008 22:08:26 +0100 Subject: [PATCH] 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 ;-) --- src/collectd.c | 3 +++ 1 file changed, 3 insertions(+) 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 -- 2.30.2