]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
ip: mroute: add fflush to print_mroute
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Fri, 26 Apr 2019 10:54:21 +0000 (13:54 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 29 Apr 2019 22:04:18 +0000 (15:04 -0700)
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>
ip/ipmroute.c

index b29c78e4cc86c96a5c562c9356c637a0212fa18c..6cf91fe934a76c9e3aad72d7dbebf66a0730ade1 100644 (file)
@@ -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;
 }