summaryrefslogtreecommitdiff
path: root/bus/main.c
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-03-31 14:51:51 +0000
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-03-31 14:51:51 +0000
commitf2e4718bf42f507684949ebf484aa94df42abbbe (patch)
tree7f6266a7e45144490b18eb6c71a953e8e0196eb9 /bus/main.c
parenta0f3687d650c8c73134f318820f4978a4ff3e9e2 (diff)
parent6528b0973bb09b0b407a5e169fdcc519087cc58d (diff)
downloaddbus-f2e4718bf42f507684949ebf484aa94df42abbbe.tar.gz
Merge tag 'dbus-1.8.0' into baserock/pedroalvarez/genivibaserock/v1.8.0
dbus-1.8.0
Diffstat (limited to 'bus/main.c')
-rw-r--r--bus/main.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/bus/main.c b/bus/main.c
index ca0be3ce..e060baa8 100644
--- a/bus/main.c
+++ b/bus/main.c
@@ -61,11 +61,6 @@ signal_handler (int sig)
{
switch (sig)
{
-#ifdef DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX
- case SIGIO:
- /* explicit fall-through */
-#endif /* DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX */
-#ifdef SIGHUP
case SIGHUP:
{
DBusString str;
@@ -91,11 +86,13 @@ signal_handler (int sig)
static const char message[] =
"Unable to write to reload pipe - buffer full?\n";
- write (STDERR_FILENO, message, strlen (message));
+ if (write (STDERR_FILENO, message, strlen (message)) != strlen (message))
+ {
+ /* ignore failure to write out a warning */
+ }
}
}
break;
-#endif
case SIGTERM:
{
@@ -113,7 +110,10 @@ signal_handler (int sig)
"Unable to write termination signal to pipe - buffer full?\n"
"Will exit instead.\n";
- write (STDERR_FILENO, message, strlen (message));
+ if (write (STDERR_FILENO, message, strlen (message)) != strlen (message))
+ {
+ /* ignore failure to write out a warning */
+ }
_exit (1);
}
}
@@ -125,7 +125,23 @@ signal_handler (int sig)
static void
usage (void)
{
- fprintf (stderr, DBUS_DAEMON_NAME " [--version] [--session] [--system] [--config-file=FILE] [--print-address[=DESCRIPTOR]] [--print-pid[=DESCRIPTOR]] [--fork] [--nofork] [--introspect] [--address=ADDRESS] [--systemd-activation] [--nopidfile]\n");
+ fprintf (stderr,
+ DBUS_DAEMON_NAME
+ " [--version]"
+ " [--session]"
+ " [--system]"
+ " [--config-file=FILE]"
+ " [--print-address[=DESCRIPTOR]]"
+ " [--print-pid[=DESCRIPTOR]]"
+ " [--introspect]"
+ " [--address=ADDRESS]"
+ " [--nopidfile]"
+ " [--nofork]"
+#ifdef DBUS_UNIX
+ " [--fork]"
+ " [--systemd-activation]"
+#endif
+ "\n");
exit (1);
}
@@ -399,19 +415,21 @@ main (int argc, char **argv)
flags &= ~BUS_CONTEXT_FLAG_FORK_ALWAYS;
flags |= BUS_CONTEXT_FLAG_FORK_NEVER;
}
+#ifdef DBUS_UNIX
else if (strcmp (arg, "--fork") == 0)
{
flags &= ~BUS_CONTEXT_FLAG_FORK_NEVER;
flags |= BUS_CONTEXT_FLAG_FORK_ALWAYS;
}
- else if (strcmp (arg, "--nopidfile") == 0)
- {
- flags &= ~BUS_CONTEXT_FLAG_WRITE_PID_FILE;
- }
else if (strcmp (arg, "--systemd-activation") == 0)
{
flags |= BUS_CONTEXT_FLAG_SYSTEMD_ACTIVATION;
}
+#endif
+ else if (strcmp (arg, "--nopidfile") == 0)
+ {
+ flags &= ~BUS_CONTEXT_FLAG_WRITE_PID_FILE;
+ }
else if (strcmp (arg, "--system") == 0)
{
check_two_config_files (&config_file, "system");
@@ -622,12 +640,7 @@ main (int argc, char **argv)
* 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);
-#endif
-#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");