diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-04-08 20:16:07 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-04-18 17:16:07 +0200 |
commit | 3915af337a8c7d8366131a00acb294dd4688e436 (patch) | |
tree | a8f0d130482832e343f931315136ab0f309a213b /src | |
parent | 053566f71a28e9afc792d222a6fd7b55f7d8f4a0 (diff) |
main: Error out when combining -i/--interactive and -f/--file
These two options are mutually exclusive, display error in that case:
# nft -i -f test.nft
Error: -i/--interactive and -f/--file options cannot be combined
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -405,9 +405,19 @@ int main(int argc, char * const *argv) nft_ctx_set_dry_run(nft, true); break; case OPT_FILE: + if (interactive) { + fprintf(stderr, + "Error: -i/--interactive and -f/--file options cannot be combined\n"); + exit(EXIT_FAILURE); + } filename = optarg; break; case OPT_INTERACTIVE: + if (filename) { + fprintf(stderr, + "Error: -i/--interactive and -f/--file options cannot be combined\n"); + exit(EXIT_FAILURE); + } interactive = true; break; case OPT_INCLUDEPATH: |