From f041efe3c26e3059df1ac8f1775f77423d4be5f6 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 31 May 2013 16:21:04 +0200 Subject: xtables-restore: output the same error message that iptables-restore uses Signed-off-by: Pablo Neira Ayuso --- iptables/nft.c | 2 +- iptables/xtables-restore.c | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/iptables/nft.c b/iptables/nft.c index ca56d0ed..7dad2464 100644 --- a/iptables/nft.c +++ b/iptables/nft.c @@ -2641,7 +2641,7 @@ static int nft_action(struct nft_handle *h, int type) if (errno != EEXIST) perror("mnl-talk:nft_commit"); } - return ret; + return ret == 0 ? 1 : 0; } int nft_commit(struct nft_handle *h) diff --git a/iptables/xtables-restore.c b/iptables/xtables-restore.c index 3b14a9f7..4f196fc6 100644 --- a/iptables/xtables-restore.c +++ b/iptables/xtables-restore.c @@ -266,22 +266,11 @@ xtables_restore_main(int argc, char *argv[]) * global commit at once, stick by now to * the existing behaviour. */ - if (nft_commit(&h)) { - fprintf(stderr, "Failed to commit " - "table %s\n", - curtable); - } DEBUGP("Calling commit\n"); - ret = 1; + ret = nft_commit(&h); } else { - if (nft_abort(&h)) { - xtables_error(OTHER_PROBLEM, - "Failed to abort " - "commit in table %s\n", - curtable); - } DEBUGP("Not calling commit, testing\n"); - ret = 1; + ret = nft_abort(&h); } in_table = 0; -- cgit v1.2.3