Subject: Re: [PATCH] dpll: Fix missing notifications in monitor mode

From: Stephen Hemminger <[email-masked]>
Date: Tue, 24 Mar 2026 09:22:35 -0700

On Thu, 12 Mar 2026 19:35:47 +0100
Andrea Claudi <[email-masked]> wrote:

> 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 <[email-masked]>
> ---
>  dpll/dpll.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/dpll/dpll.c b/dpll/dpll.c
> index 846ad4b0..84f68f76 100644
> --- a/dpll/dpll.c
> +++ b/dpll/dpll.c
> @@ -1936,6 +1936,7 @@ static int cmd_monitor(struct dpll *dpll)
>  				       strerror(errno));
>  				break;
>  			}
> +			fflush(stdout);
>  		}
>  	}
>  

Applied but moved the fflush into the callback.