summaryrefslogtreecommitdiffstats
path: root/iptables/nft.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-11-12 14:29:47 +0100
committerFlorian Westphal <fw@strlen.de>2018-11-12 14:34:13 +0100
commit85d7df90ed505d8de7ff27cc5106492049756f4e (patch)
treec7dbba1d2ab7d1d125a8c4d5952e40c661155004 /iptables/nft.c
parent3ccb443df988fd1d476de55d6ad1f69919d936af (diff)
xtables: Fix error return code in nft_chain_user_rename()
If the chain to rename wasn't found, the function would return -1 which got interpreted as success. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/nft.c')
-rw-r--r--iptables/nft.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/iptables/nft.c b/iptables/nft.c
index 5967b652..e8538d38 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -1750,14 +1750,14 @@ int nft_chain_user_rename(struct nft_handle *h,const char *chain,
c = nft_chain_find(h, table, chain);
if (c == NULL) {
errno = ENOENT;
- return -1;
+ return 0;
}
handle = nftnl_chain_get_u64(c, NFTNL_CHAIN_HANDLE);
/* Now prepare the new name for the chain */
c = nftnl_chain_alloc();
if (c == NULL)
- return -1;
+ return 0;
nftnl_chain_set(c, NFTNL_CHAIN_TABLE, (char *)table);
nftnl_chain_set(c, NFTNL_CHAIN_NAME, (char *)newname);