From e90e7e9e7188c61ca06928e3c18a5db4eaf9dd27 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 29 Jun 2011 16:20:09 +0100 Subject: [PATCH] bus signal_handler: don't pretend to be portable away from Unix Signals are POSIX but not ISO C, so guard it with DBUS_UNIX. dbus-sysdeps-util-win doesn't actually implement _dbus_set_signal_handler anyway, so not compiling this code on non-Unix seems more honest. Backported to dbus-1.4, originally part of commit c7ef3ead558e147. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336 Reviewed-by: Thiago Macieira --- bus/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bus/main.c b/bus/main.c index 13a3770..59f3e7d 100644 --- a/bus/main.c +++ b/bus/main.c @@ -54,6 +54,7 @@ typedef enum ACTION_QUIT = 'q' } SignalAction; +#ifdef DBUS_UNIX static void signal_handler (int sig) { @@ -99,6 +100,7 @@ signal_handler (int sig) break; } } +#endif /* DBUS_UNIX */ static void usage (void) @@ -572,6 +574,11 @@ main (int argc, char **argv) setup_reload_pipe (bus_context_get_loop (context)); +#ifdef DBUS_UNIX + /* POSIX signals are Unix-specific, and _dbus_set_signal_handler is + * unimplemented (and probably unimplementable) on Windows, so there's + * no point in trying to make the handler portable to non-Unix. */ + _dbus_set_signal_handler (SIGTERM, signal_handler); #ifdef SIGHUP _dbus_set_signal_handler (SIGHUP, signal_handler); @@ -579,6 +586,7 @@ main (int argc, char **argv) #ifdef DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX _dbus_set_signal_handler (SIGIO, signal_handler); #endif /* DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX */ +#endif /* DBUS_UNIX */ _dbus_verbose ("We are on D-Bus...\n"); _dbus_loop_run (bus_context_get_loop (context)); -- 2.7.4