Skip to content
  • Lennart Poettering's avatar
    dbus-monitor: use unbuffered stdout instead of handling SIGINT · 43b1f918
    Lennart Poettering authored and Colin Walters's avatar Colin Walters committed
    
    
    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: default avatarColin Walters <walters@verbum.org>
    43b1f918