7cbf7f8272acd68bb9314c6ddcfda1d5c8b24842 diff --git a/tools/dbus-monitor.c b/tools/dbus-monitor.c index 873108b..f2f7314 100644 --- a/tools/dbus-monitor.c +++ b/tools/dbus-monitor.c @@ -33,8 +33,6 @@ #include -#include - #include "dbus-print-message.h" #ifdef DBUS_WIN @@ -66,12 +64,12 @@ monitor_filter_func (DBusConnection *connection, void *user_data) { print_message (message, FALSE); - + if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected")) exit (0); - + /* Conceptually we want this to be * DBUS_HANDLER_RESULT_NOT_YET_HANDLED, but this raises * some problems. See bug 1719. @@ -195,14 +193,6 @@ usage (char *name, int ecode) exit (ecode); } -static dbus_bool_t sigint_received = FALSE; - -static void -sigint_handler (int signum) -{ - sigint_received = TRUE; -} - int main (int argc, char *argv[]) { @@ -211,9 +201,12 @@ main (int argc, char *argv[]) DBusBusType type = DBUS_BUS_SESSION; DBusHandleMessageFunction filter_func = monitor_filter_func; char *address = NULL; - + int i = 0, j = 0, numFilters = 0; char **filters = NULL; + + setvbuf(stdout, NULL, _IOLBF, 0); + for (i = 1; i < argc; i++) { char *arg = argv[i]; @@ -340,13 +333,10 @@ main (int argc, char *argv[]) } /* we handle SIGINT so exit() is reached and flushes stdout */ - signal (SIGINT, sigint_handler); - while (dbus_connection_read_write_dispatch(connection, -1) - && !sigint_received) + while (dbus_connection_read_write_dispatch(connection, -1)) ; exit (0); lose: fprintf (stderr, "Error: %s\n", error.message); exit (1); } -