From fd3479639d0a43399a15995add9d4abbcf40f22c Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Wed, 23 Jul 2014 01:07:34 +0200 Subject: main: propagate error to shell Before: # nft add rule ip test input ip hdrlength 3 :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 :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 Signed-off-by: Pablo Neira Ayuso --- src/main.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') 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; -- cgit v1.2.3