summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2016-10-20 08:32:36 +0200
committerRobert Ancell <robert.ancell@canonical.com>2016-10-20 08:32:36 +0200
commit6b538efb28dc638254b3731f2284a52e689ae9c1 (patch)
tree8bbeba55a2ebfc7dbac440c7e01047eb4bf1e3e3
parent773e4d1d664d9f7246d1c7b44462fc2eb54a5e7b (diff)
downloadlightdm-git-6b538efb28dc638254b3731f2284a52e689ae9c1.tar.gz
Re-enable SIGPIPE for children so they have default behaviour
-rw-r--r--src/lightdm.c6
-rw-r--r--src/process.c5
-rw-r--r--src/session-child.c3
3 files changed, 13 insertions, 1 deletions
diff --git a/src/lightdm.c b/src/lightdm.c
index 37ac0f49..d2c898c8 100644
--- a/src/lightdm.c
+++ b/src/lightdm.c
@@ -1160,6 +1160,12 @@ main (int argc, char **argv)
};
GError *error = NULL;
+ /* Disable the SIGPIPE handler - this is a stupid Unix hangover behaviour.
+ * We will handle piples / sockets being closed instead of having the whole daemon be killed...
+ * http://stackoverflow.com/questions/8369506/why-does-sigpipe-exist
+ */
+ signal (SIGPIPE, SIG_IGN);
+
/* When lightdm starts sessions it needs to run itself in a new mode */
if (argc >= 2 && strcmp (argv[1], "--session-child") == 0)
return session_child_run (argc, argv);
diff --git a/src/process.c b/src/process.c
index f4a4d572..29e79eb8 100644
--- a/src/process.c
+++ b/src/process.c
@@ -235,7 +235,10 @@ process_start (Process *process, gboolean block)
#endif
for (i = 0; i < env_length; i++)
setenv (env_keys[i], env_values[i], TRUE);
-
+
+ /* Reset SIGPIPE handler so the child has default behaviour (we disabled it at LightDM start) */
+ signal (SIGPIPE, SIG_DFL);
+
execvp (argv[0], argv);
_exit (EXIT_FAILURE);
}
diff --git a/src/session-child.c b/src/session-child.c
index c0266288..0b9965e2 100644
--- a/src/session-child.c
+++ b/src/session-child.c
@@ -696,6 +696,9 @@ session_child_run (int argc, char **argv)
}
}
+ /* Reset SIGPIPE handler so the child has default behaviour (we disabled it at LightDM start) */
+ signal (SIGPIPE, SIG_DFL);
+
/* Run the command */
execve (command_argv[0], command_argv, pam_getenvlist (pam_handle));
_exit (EXIT_FAILURE);