From: Pablo Neira Ayuso Date: Tue, 22 Jul 2014 23:07:34 +0000 (+0200) Subject: main: propagate error to shell X-Git-Tag: v0.4~118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd3479639d0a43399a15995add9d4abbcf40f22c;p=thirdparty%2Fnftables.git 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 --- 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;