summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2012-04-27 11:14:42 -0400
committerColin Walters <walters@verbum.org>2012-04-27 18:06:05 -0400
commitc030b9bfe8b3e59b8c99802cc53fd0229bbd154a (patch)
treeb874e10cf0c037d02e5d5af0eae8516ed129dd46
parent707c5a74d807e0d59b2552246915e5a79a721472 (diff)
downloadgdm-c030b9bfe8b3e59b8c99802cc53fd0229bbd154a.tar.gz
welcome: Use Linux PR_SET_PDEATHSIG to ensure dbus-daemon dies when we do
It's convenient for debugging to "kill -9 $(pidof gdm-binary)", but presently because gdm runs bare "dbus-launch" which daemonizes, it won't terminate when the parent gdm welcome session dies. Other approaches here are to use "dbus-daemon --no-fork --print-address" directly as a child, and kill it when we get SIGTERM: http://git.gnome.org/browse/at-spi2-core/tree/bus/at-spi-bus-launcher.c But this is an easy fix, even if it only works on Linux. https://bugzilla.gnome.org/show_bug.cgi?id=674982
-rw-r--r--daemon/gdm-welcome-session.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/daemon/gdm-welcome-session.c b/daemon/gdm-welcome-session.c
index 778d5dce..3431edba 100644
--- a/daemon/gdm-welcome-session.c
+++ b/daemon/gdm-welcome-session.c
@@ -32,6 +32,9 @@
#include <pwd.h>
#include <grp.h>
#include <signal.h>
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#endif
#include <glib.h>
#include <glib/gi18n.h>
@@ -469,6 +472,11 @@ spawn_child_setup (SpawnChildData *data)
_exit (2);
}
+ /* Terminate the process when the parent dies */
+#ifdef HAVE_SYS_PRCTL_H
+ prctl (PR_SET_PDEATHSIG, SIGTERM);
+#endif
+
if (data->log_file != NULL) {
int logfd;