]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Re-enable SIGPIPE for children so they have default behaviour
authorRobert Ancell <robert.ancell@canonical.com>
Wed, 19 Oct 2016 12:24:49 +0000 (14:24 +0200)
committerRobert Ancell <robert.ancell@canonical.com>
Wed, 19 Oct 2016 12:24:49 +0000 (14:24 +0200)
src/lightdm.c
src/process.c
src/session-child.c

index e64fc874d82ba4f1ab37beff43753044cf41501f..fd62314cfe406d44aa2a164e1ba0e974bd7a02f0 100644 (file)
@@ -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);
index d9b7eb9ae16875a3a164533f2cf5bbdf17860c7a..75357db615b99466fe31b0988479cbfb8d102395 100644 (file)
@@ -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);
     }
index e393ce4c7c41ae48ab88efa69efff5851434a879..fb12d9b812d02f0ee9ebf3a35a53a74249cd5f0b 100644 (file)
@@ -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);