public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dpll: Fix missing notifications in monitor mode
@ 2026-03-12 18:35 Andrea Claudi
  2026-03-24 16:22 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Andrea Claudi @ 2026-03-12 18:35 UTC (permalink / raw)
  To: netdev; +Cc: Ivan Vecera, Petr Oros, Stephen Hemminger, David Ahern

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>
---
 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);
 		}
 	}
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dpll: Fix missing notifications in monitor mode
  2026-03-12 18:35 [PATCH] dpll: Fix missing notifications in monitor mode Andrea Claudi
@ 2026-03-24 16:22 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2026-03-24 16:22 UTC (permalink / raw)
  To: Andrea Claudi; +Cc: netdev, Ivan Vecera, Petr Oros, David Ahern

On Thu, 12 Mar 2026 19:35:47 +0100
Andrea Claudi <aclaudi@redhat.com> 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 <aclaudi@redhat.com>
> ---
>  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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-24 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 18:35 [PATCH] dpll: Fix missing notifications in monitor mode Andrea Claudi
2026-03-24 16:22 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox