]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables-events: print usage on wrong arguments
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 16 Jul 2013 19:55:15 +0000 (21:55 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 30 Dec 2013 22:50:37 +0000 (23:50 +0100)
Set opterr to zero to skip getopt_long error reporting.

This also fixes the following compilation warning:

xtables-events.c:148:13: warning: ‘print_usage’ defined but not used [-Wunused-function]

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/xtables-events.c

index 2600a250e3014101f2e65bbaf7b6b15bc8ad6b2a..d4542f0bd5c8b9ef8c9b2fcca3d524111a4ae36b 100644 (file)
@@ -172,11 +172,15 @@ int xtables_events_main(int argc, char *argv[])
        init_extensions4();
 #endif
 
+       opterr = 0;
        while ((c = getopt_long(argc, argv, "c", options, NULL)) != -1) {
                switch (c) {
                case 'c':
                        counters = true;
                        break;
+               default:
+                       print_usage(argv[0], XTABLES_VERSION);
+                       exit(EXIT_FAILURE);
                }
        }