diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-07-23 01:07:34 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-07-25 03:41:17 +0200 |
commit | fd3479639d0a43399a15995add9d4abbcf40f22c (patch) | |
tree | d3ff024815483158e9f2d96c76735b92252c5686 /src/main.c | |
parent | b1a348208a9e5749860a95ceb0307fc16f2edb7f (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/main.c')
-rw-r--r-- | src/main.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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; |