dbus/tools dbus-monitor.c,1.17,1.18
John Palmieri
johnp at kemper.freedesktop.org
Wed Nov 8 15:10:50 PST 2006
Update of /cvs/dbus/dbus/tools
In directory kemper:/tmp/cvs-serv32453/tools
Modified Files:
dbus-monitor.c
Log Message:
* tools/dbus-monitor.c: Handle sigint so we flush stdout
(Patch from Olli Salli <olli dot salli at collabora dot co dot uk>)
Index: dbus-monitor.c
===================================================================
RCS file: /cvs/dbus/dbus/tools/dbus-monitor.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- dbus-monitor.c 8 Nov 2006 15:49:30 -0000 1.17
+++ dbus-monitor.c 8 Nov 2006 23:10:48 -0000 1.18
@@ -26,6 +26,8 @@
#include <sys/time.h>
#include <time.h>
+#include <signal.h>
+
#include "dbus-print-message.h"
static DBusHandlerResult
@@ -163,6 +165,14 @@
exit (ecode);
}
+dbus_bool_t sigint_received = FALSE;
+
+static void
+sigint_handler (int signum)
+{
+ sigint_received = TRUE;
+}
+
int
main (int argc, char *argv[])
{
@@ -254,7 +264,11 @@
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:
More information about the dbus-commit
mailing list