summaryrefslogtreecommitdiff
path: root/bus/main.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-06-29 16:20:09 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-08-05 14:39:24 +0100
commite90e7e9e7188c61ca06928e3c18a5db4eaf9dd27 (patch)
tree557459328ada9780831b91e11202fb6d30017474 /bus/main.c
parent3cf9fa4dc76d9c85f8490b2437562672668d65d5 (diff)
downloaddbus-e90e7e9e7188c61ca06928e3c18a5db4eaf9dd27.tar.gz
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 <thiago@kde.org>
Diffstat (limited to 'bus/main.c')
-rw-r--r--bus/main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/bus/main.c b/bus/main.c
index 13a37700..59f3e7d0 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));