diff options
author | Vincent Bernat <vincent@bernat.im> | 2017-04-15 12:16:47 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-04-19 18:00:41 +0200 |
commit | d89dc47ab3875f6fe6679cebceccd2000bf81b8e (patch) | |
tree | fe990365c13f083b184ccb8933cf9489577aa87b /iptables/iptables-save.c | |
parent | 65801d02a482befd2745c792d6596ec75d434934 (diff) |
iptables-restore/save: exit when given an unknown option
When an unknown option is given, iptables-restore should exit instead of
continue its operation. For example, if `--table` was misspelled, this
could lead to an unwanted change. Moreover, exit with a status code of
1. Make the same change for iptables-save.
OTOH, exit with a status code of 0 when requesting help.
Signed-off-by: Vincent Bernat <vincent@bernat.im>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/iptables-save.c')
-rw-r--r-- | iptables/iptables-save.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/iptables/iptables-save.c b/iptables/iptables-save.c index fbc60593..52929b09 100644 --- a/iptables/iptables-save.c +++ b/iptables/iptables-save.c @@ -161,6 +161,10 @@ iptables_save_main(int argc, char *argv[]) case 'd': do_output(tablename); exit(0); + default: + fprintf(stderr, + "Look at manual page `iptables-save.8' for more information.\n"); + exit(1); } } |