summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2016-10-20 08:28:54 +0200
committerRobert Ancell <robert.ancell@canonical.com>2016-10-20 08:28:54 +0200
commit2a4a24c7ca7c4c1c9957c29ea8f0f02da7613c33 (patch)
treed04dad627ad2699f019a2b981bf5698b60c2ae89
parent3df5bef00c67cf0c66078cbfbf098c93f429d6d7 (diff)
parent54c11400ce3da1cf950543ca9a9b41cb83e626d7 (diff)
downloadlightdm-git-2a4a24c7ca7c4c1c9957c29ea8f0f02da7613c33.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 e64fc874..fd62314c 100644
--- a/src/lightdm.c
+++ b/src/lightdm.c
@@ -1225,6 +1225,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);