From 8e6bce735a132150c23503a55ea0aef55a01425f Mon Sep 17 00:00:00 2001 From: Amit Cohen Date: Thu, 20 Aug 2020 16:51:13 +0300 Subject: [PATCH] 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 --- devlink/devlink.c | 1 + 1 file changed, 1 insertion(+) 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; } -- 2.47.2