xtables-events: print usage on wrong arguments
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>
diff --git a/iptables/xtables-events.c b/iptables/xtables-events.c
index 2600a25..d4542f0 100644
--- a/iptables/xtables-events.c
+++ b/iptables/xtables-events.c
@@ -172,11 +172,15 @@
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);
}
}