summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2016-10-20 08:31:11 +0200
committerRobert Ancell <robert.ancell@canonical.com>2016-10-20 08:31:11 +0200
commit3a73386b4f50bd87ac5613f55a3ec908f1905339 (patch)
tree658909eef464b9b87883c023624d25603823dc74
parent31d390a6c7712f65916b79b3de45933cab8c58d2 (diff)
downloadlightdm-git-3a73386b4f50bd87ac5613f55a3ec908f1905339.tar.gz
Re-enable SIGPIPE for children so they have default behaviour
-rw-r--r--src/lightdm.c6
-rw-r--r--src/process.c3
-rw-r--r--src/session-child.c3
3 files changed, 12 insertions, 0 deletions
diff --git a/src/lightdm.c b/src/lightdm.c
index 32ab3c05..610c5aee 100644
--- a/src/lightdm.c
+++ b/src/lightdm.c
@@ -1214,6 +1214,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 d9b7eb9a..75357db6 100644
--- a/src/process.c
+++ b/src/process.c
@@ -236,6 +236,9 @@ process_start (Process *process, gboolean block)
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 e393ce4c..fb12d9b8 100644
--- a/src/session-child.c
+++ b/src/session-child.c
@@ -704,6 +704,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);