From d65702c5c5bbab0ef12298386fa4098c72584e6c Mon Sep 17 00:00:00 2001 From: Jonh Wendell Date: Wed, 4 Jan 2012 15:44:01 -0200 Subject: libiptc: Returns the position the entry was inserted Jan Engelhardt showed no objections to this patch. --- include/libiptc/libiptc.h | 3 ++- libiptc/libiptc.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/libiptc/libiptc.h b/include/libiptc/libiptc.h index 24cdbdb7..b9a42c96 100644 --- a/include/libiptc/libiptc.h +++ b/include/libiptc/libiptc.h @@ -74,7 +74,8 @@ int iptc_replace_entry(const xt_chainlabel chain, struct xtc_handle *handle); /* Append entry `e' to chain `chain'. Equivalent to insert with - rulenum = length of chain. */ + rulenum = length of chain. Returns the position the entry was + inserted or 0 if an error occurs */ int iptc_append_entry(const xt_chainlabel chain, const struct ipt_entry *e, struct xtc_handle *handle); diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c index 63fcfc2a..ddaee128 100644 --- a/libiptc/libiptc.c +++ b/libiptc/libiptc.c @@ -1836,7 +1836,8 @@ TC_REPLACE_ENTRY(const IPT_CHAINLABEL chain, } /* Append entry `fw' to chain `chain'. Equivalent to insert with - rulenum = length of chain. */ + rulenum = length of chain. Returns the position the entry was + inserted or 0 if an error occurs */ int TC_APPEND_ENTRY(const IPT_CHAINLABEL chain, const STRUCT_ENTRY *e, @@ -1872,7 +1873,7 @@ TC_APPEND_ENTRY(const IPT_CHAINLABEL chain, set_changed(handle); - return 1; + return c->num_rules; } static inline int -- cgit v1.2.3