[gdm] welcome: Use Linux PR_SET_PDEATHSIG to ensure dbus-daemon dies when we do



commit c030b9bfe8b3e59b8c99802cc53fd0229bbd154a
Author: Colin Walters <walters verbum org>
Date:   Fri Apr 27 11:14:42 2012 -0400

    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

 daemon/gdm-welcome-session.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gdm-welcome-session.c b/daemon/gdm-welcome-session.c
index 778d5dc..3431edb 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;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]