path: root/src/netlink.c
diff options
authorPhil Sutter <>2017-09-28 17:17:43 +0200
committerPablo Neira Ayuso <>2017-09-29 12:37:44 +0200
commit89122493a39f76a530ee0db862986d63b9186e83 (patch)
tree8f9712a786feb0cc625bd3f2fdf6513a6b997c19 /src/netlink.c
parent9c4747d04075ad1e79aa0f346e7227a43e72405e (diff)
erec_print: Pass output FILE pointer to netlink_dump_expr()
It was a bit odd that erec_print() outputs to a given FILE pointer but then calls netlink_dump_expr() which just prints to stdout. Fix this by passing the given FILE pointer along so output is guaranteed to go to the same destination. Signed-off-by: Phil Sutter <> Signed-off-by: Pablo Neira Ayuso <>
Diffstat (limited to 'src/netlink.c')
1 files changed, 3 insertions, 2 deletions
diff --git a/src/netlink.c b/src/netlink.c
index e414718b..3183a810 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -515,7 +515,8 @@ void netlink_dump_rule(const struct nftnl_rule *nlr, unsigned int debug_mask)
fprintf(stdout, "%s\n", buf);
-void netlink_dump_expr(const struct nftnl_expr *nle, unsigned int debug_mask)
+void netlink_dump_expr(const struct nftnl_expr *nle,
+ FILE *fp, unsigned int debug_mask)
char buf[4096];
@@ -523,7 +524,7 @@ void netlink_dump_expr(const struct nftnl_expr *nle, unsigned int debug_mask)
nftnl_expr_snprintf(buf, sizeof(buf), nle, 0, 0);
- fprintf(stdout, "%s\n", buf);
+ fprintf(fp, "%s\n", buf);
static int list_rule_cb(struct nftnl_rule *nlr, void *arg)