dbus-monitor: use unbuffered stdout instead of handling SIGINT
authorLennart Poettering <mzqohf@0pointer.de>
Fri, 31 Jul 2009 16:26:57 +0000 (12:26 -0400)
committerColin Walters <walters@verbum.org>
Fri, 31 Jul 2009 16:27:48 +0000 (12:27 -0400)
commit43b1f91865bcaa3929c9039fb4aa1c0ee34f54e8
treedfe256b59166aa4df969a38d57e694df07886fe4
parent1116f210aa2bfda9ee96112b81c1f2db100dee95
dbus-monitor: use unbuffered stdout instead of handling SIGINT

The current SIGINT handling of dbus-monitor ain't making too many people
happy since it defers the exit to the next msg received -- which might
be quite some time away often enough.

This patch replaces the SIGINT handling by simply enabling line-buffered
IO for STDOUT so that even if you redirect dbus-monitor into a file no
lines get accidently lost and the effect of C-c is still immediate.

halfline came up with the great idea to use setvbuf here instead of
fflush()ing after each printf().

(Oh and the old signal handler was broken anyway, the flag should have
been of type sigatomic_t and be marked volatile)

Signed-off-by: Colin Walters <walters@verbum.org>
tools/dbus-monitor.c