summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2014-07-23 01:07:34 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2014-07-25 03:41:17 +0200
commitfd3479639d0a43399a15995add9d4abbcf40f22c (patch)
treed3ff024815483158e9f2d96c76735b92252c5686 /src
parentb1a348208a9e5749860a95ceb0307fc16f2edb7f (diff)
main: propagate error to shell
Before: # nft add rule ip test input ip hdrlength 3 <cmdline>:1:1-37: Error: Could not process rule: Invalid argument add rule ip test input ip hdrlength 3 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # echo $? 0 After: # nft add rule ip test input ip hdrlength 3 <cmdline>:1:1-37: Error: Could not process rule: Invalid argument add rule ip test input ip hdrlength 3 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # echo $? 1 Reported-by: Ana Rey Botello <anarey@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index bd8feee5..04a98e35 100644
--- a/src/main.c
+++ b/src/main.c
@@ -200,6 +200,8 @@ static int nft_netlink(struct parser_state *state, struct list_head *msgs)
netlink_io_error(&ctx, &cmd->location,
"Could not process rule: %s",
strerror(err->err));
+ ret = -1;
+ errno = err->err;
if (err->seqnum == cmd->seqnum) {
mnl_err_list_free(err);
break;