From: Nikolay Aleksandrov Date: Fri, 26 Apr 2019 10:54:21 +0000 (+0300) Subject: ip: mroute: add fflush to print_mroute X-Git-Tag: v5.1.0~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09e0528cf977150fcf6b849671091501b0958fdb;p=thirdparty%2Fiproute2.git ip: mroute: add fflush to print_mroute Similar to other print functions we need to flush buffered data in order to work with pipes and output redirects. After this patch ip monitor mroute &>log works properly. Signed-off-by: Nikolay Aleksandrov Signed-off-by: Stephen Hemminger --- diff --git a/ip/ipmroute.c b/ip/ipmroute.c index b29c78e4c..6cf91fe93 100644 --- a/ip/ipmroute.c +++ b/ip/ipmroute.c @@ -57,6 +57,7 @@ int print_mroute(struct nlmsghdr *n, void *arg) struct rtmsg *r = NLMSG_DATA(n); int len = n->nlmsg_len; struct rtattr *tb[RTA_MAX+1]; + FILE *fp = arg; const char *src, *dst; SPRINT_BUF(b1); SPRINT_BUF(b2); @@ -209,6 +210,7 @@ int print_mroute(struct nlmsghdr *n, void *arg) print_string(PRINT_FP, NULL, "\n", NULL); close_json_object(); + fflush(fp); return 0; }