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 <nikolay@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
38983334f6
commit
09e0528cf9
|
|
@ -57,6 +57,7 @@ int print_mroute(struct nlmsghdr *n, void *arg)
|
||||||
struct rtmsg *r = NLMSG_DATA(n);
|
struct rtmsg *r = NLMSG_DATA(n);
|
||||||
int len = n->nlmsg_len;
|
int len = n->nlmsg_len;
|
||||||
struct rtattr *tb[RTA_MAX+1];
|
struct rtattr *tb[RTA_MAX+1];
|
||||||
|
FILE *fp = arg;
|
||||||
const char *src, *dst;
|
const char *src, *dst;
|
||||||
SPRINT_BUF(b1);
|
SPRINT_BUF(b1);
|
||||||
SPRINT_BUF(b2);
|
SPRINT_BUF(b2);
|
||||||
|
|
@ -209,6 +210,7 @@ int print_mroute(struct nlmsghdr *n, void *arg)
|
||||||
|
|
||||||
print_string(PRINT_FP, NULL, "\n", NULL);
|
print_string(PRINT_FP, NULL, "\n", NULL);
|
||||||
close_json_object();
|
close_json_object();
|
||||||
|
fflush(fp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue