summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorArturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>2013-10-11 13:03:08 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2013-10-17 11:08:40 +0200
commit2855909e46f4646f137a96892bd5c465fa1193f8 (patch)
tree8d43279f1d488f618b878befbef6821b7ce61d4a /src/main.c
parent8bd599c66b05c4b8bba2564b3f4cd77e719a660c (diff)
src: fix return code
Exit with NFT_EXIT_FAILURE if something went wrong in the netlink code. Before this patch: internal:0:0-0: Error: Could not find chain `asd' in table `filter': [...] 0 After this patch: internal:0:0-0: Error: Could not find chain `asd' in table `filter': [...] 1 Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 3ddcb713..0c97120b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -222,7 +222,7 @@ int main(int argc, char * const *argv)
char *buf = NULL, *filename = NULL;
unsigned int len;
bool interactive = false;
- int i, val;
+ int i, val, rc = NFT_EXIT_SUCCESS;
while (1) {
val = getopt_long(argc, argv, OPTSTRING, options, NULL);
@@ -318,11 +318,12 @@ int main(int argc, char * const *argv)
exit(NFT_EXIT_FAILURE);
}
- nft_run(scanner, &state, &msgs);
+ if (nft_run(scanner, &state, &msgs) != 0)
+ rc = NFT_EXIT_FAILURE;
out:
scanner_destroy(scanner);
erec_print_list(stdout, &msgs);
xfree(buf);
- return 0;
+ return rc;
}