]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
netlink: Use nftnl_expr_fprintf() in netlink_dump_expr()
authorPhil Sutter <phil@nwl.cc>
Wed, 4 Oct 2017 21:41:11 +0000 (23:41 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 17 Oct 2017 13:20:08 +0000 (15:20 +0200)
This gets rid of the temporary buffer.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/netlink.c

index e8d0e31348f010df34bef03a3f7cf845fec9a6f9..921788932fc2b91280ca1501e3afb295af708472 100644 (file)
@@ -520,13 +520,11 @@ void netlink_dump_rule(const struct nftnl_rule *nlr, struct netlink_ctx *ctx)
 void netlink_dump_expr(const struct nftnl_expr *nle,
                       FILE *fp, unsigned int debug_mask)
 {
-       char buf[4096];
-
        if (!(debug_mask & DEBUG_NETLINK))
                return;
 
-       nftnl_expr_snprintf(buf, sizeof(buf), nle, 0, 0);
-       fprintf(fp, "%s\n", buf);
+       nftnl_expr_fprintf(fp, nle, 0, 0);
+       fprintf(fp, "\n");
 }
 
 static int list_rule_cb(struct nftnl_rule *nlr, void *arg)