]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
devlink: Add fflush() in cmd_mon_show_cb()
authorAmit Cohen <amcohen@nvidia.com>
Thu, 20 Aug 2020 13:51:13 +0000 (16:51 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Sun, 23 Aug 2020 04:13:11 +0000 (21:13 -0700)
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>
devlink/devlink.c

index 8ec96c01fbcf92b1de51d9cda67451f34dbadbd6..007677a5c5648c6fc98fcfd2d616e1732318ba51 100644 (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;
 }