]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables-restore: output the same error message that iptables-restore uses
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 31 May 2013 14:21:04 +0000 (16:21 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 30 Dec 2013 22:50:31 +0000 (23:50 +0100)
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/nft.c
iptables/xtables-restore.c

index ca56d0edebea2d9907c4ad39a11ebd16b11242bd..7dad2464ce824dc9fdafebb007ec91e3842f75ba 100644 (file)
@@ -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)
index 3b14a9f73328f378a696ed777483d8013f2e9e50..4f196fc67c0b8b59ae57972cbb38ad1acc4cbdd2 100644 (file)
@@ -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;