diff options
author | William Jon McCann <jmccann@redhat.com> | 2010-06-15 12:00:25 -0400 |
---|---|---|
committer | William Jon McCann <jmccann@redhat.com> | 2010-06-15 12:17:16 -0400 |
commit | 712cd8d8faa05151f979ac3baf53868bae78c7f8 (patch) | |
tree | 66c0efab8b8e43679e2d5b6be22346ad2edb0a01 /daemon | |
parent | 85ac2e9047e7518153241ac71c50ba9e2fd0a4c2 (diff) | |
download | gdm-712cd8d8faa05151f979ac3baf53868bae78c7f8.tar.gz |
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
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/gdm-server.c | 8 | ||||
-rw-r--r-- | 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 840a0300..dbe29efe 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 633d6e29..149d83a6 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 |