diff options
author | Simon McVittie <smcv@debian.org> | 2014-10-01 19:45:00 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2014-10-01 19:45:00 +0100 |
commit | 255f62947424c4622609eb93ed53371dda28aac9 (patch) | |
tree | 6f8c5dbb96e48fa2d40919bb3282fae0b6d953de /tools/dbus-launch.c | |
parent | c03b8e681afa8e45977fc74e30142497939b47d1 (diff) | |
parent | 33ee25f98af863e9355fd53b9184c0b798343b89 (diff) | |
download | dbus-upstream/1.9.0.tar.gz |
Imported Upstream version 1.9.0upstream/1.9.0
Diffstat (limited to 'tools/dbus-launch.c')
-rw-r--r-- | tools/dbus-launch.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c index 7ecee63e..41a20e83 100644 --- a/tools/dbus-launch.c +++ b/tools/dbus-launch.c @@ -406,6 +406,9 @@ static pid_t bus_pid_to_kill = -1; static void kill_bus(void) { + if (bus_pid_to_kill <= 0) + return; + verbose ("Killing message bus and exiting babysitter\n"); kill (bus_pid_to_kill, SIGTERM); sleep (3); @@ -533,7 +536,7 @@ kill_bus_when_session_ends (void) if (tty_fd < 0 && x_fd < 0) { fprintf (stderr, "No terminal on standard input and no X display; cannot attach message bus to session lifetime\n"); - exit (1); + kill_bus_and_exit (1); } while (TRUE) @@ -1275,6 +1278,10 @@ main (int argc, char **argv) bus_pid = val; + /* Have to initialize bus_pid_to_kill ASAP, so that the + X error callback can kill it if an error happens. */ + bus_pid_to_kill = bus_pid; + close (bus_pid_to_launcher_pipe[READ_END]); #ifdef DBUS_ENABLE_X11_AUTOLAUNCH @@ -1291,7 +1298,6 @@ main (int argc, char **argv) { char *address = NULL; /* another window got added. Return its address */ - bus_pid_to_kill = bus_pid; if (x11_get_address (&address, &bus_pid, &wid) && address != NULL) { |