]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
dpll: Fix missing notifications in monitor mode
authorAndrea Claudi <aclaudi@redhat.com>
Thu, 12 Mar 2026 18:35:47 +0000 (19:35 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 24 Mar 2026 16:18:56 +0000 (09:18 -0700)
When running dpll monitor with output redirected to a file, notifications
could be lost because stdout is fully buffered for file redirection instead
of line-buffered like in interactive mode. If the program is killed or
crashes, buffered data is lost before reaching the file.

Fix by calling fflush(stdout) after each notification to ensure immediate
writes to the log file.

Fixes: 656cfc3ce05b ("dpll: Add dpll command")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
dpll/dpll.c

index 0effa5a9c67e7210bd8f04d2ffa58a02d613cd6a..7b05bf860ecd56b378c11632532adba47efa0eb7 100644 (file)
@@ -1883,6 +1883,7 @@ static int cmd_monitor_cb(const struct nlmsghdr *nlh, void *data)
                break;
        }
 
+       fflush(stdout);
        return ret;
 }