2006-11-08 John (J5) Palmieri <johnp@redhat.com>
+ * tools/dbus-monitor.c: Handle sigint so we flush stdout
+ (Patch from Olli Salli <olli dot salli at collabora dot co dot uk>)
+
+
+2006-11-08 John (J5) Palmieri <johnp@redhat.com>
+
* tools/dbus-monitor.1: update the manpage for dbus-monitor
(Patch from Olli Salli <olli dot salli at collabora dot co dot uk>)
#include <sys/time.h>
#include <time.h>
+#include <signal.h>
+
#include "dbus-print-message.h"
static DBusHandlerResult
exit (ecode);
}
+dbus_bool_t sigint_received = FALSE;
+
+static void
+sigint_handler (int signum)
+{
+ sigint_received = TRUE;
+}
+
int
main (int argc, char *argv[])
{
fprintf (stderr, "Couldn't add filter!\n");
exit (1);
}
- while (dbus_connection_read_write_dispatch(connection, -1))
+
+ /* we handle SIGINT so exit() is reached and flushes stdout */
+ signal (SIGINT, sigint_handler);
+ while (dbus_connection_read_write_dispatch(connection, -1)
+ && !sigint_received)
;
exit (0);
lose: