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 <amcohen@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Amit Cohen 2020-08-20 16:51:13 +03:00 committed by Stephen Hemminger
parent 7e7a1d107b
commit 8e6bce735a
1 changed files with 1 additions and 0 deletions

View File

@ -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;
}