]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blobdiff - src/lightdm.c
Re-enable SIGPIPE for children so they have default behaviour
[sojka/lightdm.git] / src / lightdm.c
index 6e24152240d4956dd7b3944750fa447c1aeaf323..fd62314cfe406d44aa2a164e1ba0e974bd7a02f0 100644 (file)
@@ -1123,9 +1123,10 @@ login1_active_session_changed_cb (Login1Seat *login1_seat, const gchar *login1_s
     if (seat)
     {
         Session *active_session;
-        active_session = seat_get_expected_active_session (seat);
 
-        if (g_strcmp0 (login1_session_id, session_get_login1_session_id (active_session)) == 0)
+        active_session = seat_get_expected_active_session (seat);
+        if (active_session != NULL &&
+            g_strcmp0 (login1_session_id, session_get_login1_session_id (active_session)) == 0)
         {
             // Session is already active
             g_debug ("Session %s is already active", login1_session_id);
@@ -1224,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);