[patch] Make dbus-monitor flush its output on CTRL-C

Havoc Pennington hp at redhat.com
Wed Nov 8 09:29:33 PST 2006

Olli Salli wrote:
> Hi,
> I noticed that when you run dbus-monitor redirecting its output to a file and terminate it, its output in the file will be truncated due to stdio buffers not getting flushed. This patch adds a SIGINT handler which flushes the buffers and exits, so the full output is always present.

I thought glibc did this anyway? Maybe only for stderr?

I don't think it's technically allowed to do this in a signal handler, 
though of course it's harmless in practice. Patch seems fine. Maybe you 
want to add a comment "this isn't signal-safe but it's a best-effort 
thing" to avoid signal-safety police filing bugs. ;-)


More information about the dbus mailing list