[gdm/gnome-2-30] Terminate subprocesses after the slave dies
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/gnome-2-30] Terminate subprocesses after the slave dies
- Date: Tue, 15 Jun 2010 16:17:02 +0000 (UTC)
commit 91fd78b4e94ac7cf9985bf478ab05fefbb310fb9
Author: William Jon McCann <jmccann redhat com>
Date: Tue Jun 15 12:00:25 2010 -0400
Terminate subprocesses after the slave dies
This will help prevent leaving the system in an inconsistent state.
https://bugzilla.gnome.org/show_bug.cgi?id=621661
daemon/gdm-server.c | 8 ++++++++
daemon/gdm-session-worker-job.c | 7 +++++++
2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gdm-server.c b/daemon/gdm-server.c
index 9dc01f7..7a1c840 100644
--- a/daemon/gdm-server.c
+++ b/daemon/gdm-server.c
@@ -33,6 +33,9 @@
#include <grp.h>
#include <signal.h>
#include <sys/resource.h>
+#if defined (__linux__)
+#include <sys/prctl.h>
+#endif
#include <glib.h>
#include <glib/gi18n.h>
@@ -464,6 +467,11 @@ server_child_setup (GdmServer *server)
sigemptyset (&mask);
sigprocmask (SIG_SETMASK, &mask, NULL);
+ /* Terminate the process when the parent dies */
+#if defined (__linux__)
+ prctl (PR_SET_PDEATHSIG, SIGTERM);
+#endif
+
if (server->priv->priority != 0) {
if (setpriority (PRIO_PROCESS, 0, server->priv->priority)) {
g_warning (_("%s: Server priority couldn't be set to %d: %s"),
diff --git a/daemon/gdm-session-worker-job.c b/daemon/gdm-session-worker-job.c
index 633d6e2..149d83a 100644
--- a/daemon/gdm-session-worker-job.c
+++ b/daemon/gdm-session-worker-job.c
@@ -32,6 +32,9 @@
#include <pwd.h>
#include <grp.h>
#include <signal.h>
+#if defined (__linux__)
+#include <sys/prctl.h>
+#endif
#include <glib.h>
#include <glib/gi18n.h>
@@ -84,6 +87,10 @@ G_DEFINE_TYPE (GdmSessionWorkerJob, gdm_session_worker_job, G_TYPE_OBJECT)
static void
session_worker_job_child_setup (GdmSessionWorkerJob *session_worker_job)
{
+ /* Terminate the process when the parent dies */
+#if defined (__linux__)
+ prctl (PR_SET_PDEATHSIG, SIGTERM);
+#endif
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]