summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2024-07-12 13:03:18 +0200
committerPhil Sutter <phil@nwl.cc>2024-07-27 14:32:39 +0200
commit69da16a7790048a176a44530eb57e4b60184ce6e (patch)
tree094e2a437aa8d22d9d273dfc5a656940648df544
parenta5e7f9d14ee404544e2751232e69f993b16e7396 (diff)
xtables-monitor: Flush stdout after all lines of output
Writing an xtables-monitor testsuite is pretty much impossible without this due to unreliable output flushing. Just move the fflush() call from trace_cb() to its caller so monitor events benefit from it as well. Fixes: 07af4da52ab30 ("xtables-monitor: fix rule printing") Signed-off-by: Phil Sutter <phil@nwl.cc>
-rw-r--r--iptables/xtables-monitor.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/iptables/xtables-monitor.c b/iptables/xtables-monitor.c
index cf92355f..90d1cc5e 100644
--- a/iptables/xtables-monitor.c
+++ b/iptables/xtables-monitor.c
@@ -544,7 +544,6 @@ static int trace_cb(const struct nlmsghdr *nlh, struct cb_arg *arg)
err_free:
nftnl_trace_free(nlt);
err:
- fflush(stdout);
return MNL_CB_OK;
}
@@ -576,6 +575,7 @@ static int monitor_cb(const struct nlmsghdr *nlh, void *data)
break;
}
+ fflush(stdout);
return ret;
}