From 712cd8d8faa05151f979ac3baf53868bae78c7f8 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Tue, 15 Jun 2010 12:00:25 -0400 Subject: 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(+) diff --git a/daemon/gdm-server.c b/daemon/gdm-server.c index 840a0300..dbe29efe 100644 --- a/daemon/gdm-server.c +++ b/daemon/gdm-server.c @@ -33,6 +33,9 @@ #include #include #include +#if defined (__linux__) +#include +#endif #include #include @@ -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 633d6e29..149d83a6 100644 --- a/daemon/gdm-session-worker-job.c +++ b/daemon/gdm-session-worker-job.c @@ -32,6 +32,9 @@ #include #include #include +#if defined (__linux__) +#include +#endif #include #include @@ -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 -- cgit v1.2.1