From: Amit Cohen Date: Thu, 20 Aug 2020 13:51:13 +0000 (+0300) Subject: devlink: Add fflush() in cmd_mon_show_cb() X-Git-Tag: v5.9.0~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e6bce735a132150c23503a55ea0aef55a01425f;p=thirdparty%2Fiproute2.git devlink: Add fflush() in cmd_mon_show_cb() Similar to other print functions we need to flush buffered data in order to work with pipes and output redirects. Without it, stdout output is buffered and not written to the disk. This is useful when writing scripts that rely on devlink-monitor output. Signed-off-by: Amit Cohen Reviewed-by: Ido Schimmel Reviewed-by: Jiri Pirko Signed-off-by: Stephen Hemminger --- diff --git a/devlink/devlink.c b/devlink/devlink.c index 8ec96c01f..007677a5c 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -4654,6 +4654,7 @@ static int cmd_mon_show_cb(const struct nlmsghdr *nlh, void *data) pr_out_trap_policer(dl, tb, false); break; } + fflush(stdout); return MNL_CB_OK; }