]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blobdiff - src/session-child.c
Re-enable SIGPIPE for children so they have default behaviour
[sojka/lightdm.git] / src / session-child.c
index 9dd079c04be59912fa5bc1f516259795daaeaed9..fb12d9b812d02f0ee9ebf3a35a53a74249cd5f0b 100644 (file)
@@ -280,6 +280,12 @@ session_child_run (int argc, char **argv)
     const gchar *locale_value;
     gchar *locale_var;
     static const gchar * const locale_var_names[] = {
+        "LC_PAPER",
+        "LC_NAME",
+        "LC_ADDRESS",
+        "LC_TELEPHONE",
+        "LC_MEASUREMENT",
+        "LC_IDENTIFICATION",
         "LC_COLLATE",
         "LC_CTYPE",
         "LC_MONETARY",
@@ -402,11 +408,8 @@ session_child_run (int argc, char **argv)
             ut.ut_type = USER_PROCESS;
             ut.ut_pid = getpid ();
             if (xdisplay)
-            {
-                strncpy (ut.ut_line, xdisplay, sizeof (ut.ut_line));
                 strncpy (ut.ut_id, xdisplay, sizeof (ut.ut_id));
-            }
-            else if (tty)
+            if (tty && g_str_has_prefix (tty, "/dev/"))
                 strncpy (ut.ut_line, tty + strlen ("/dev/"), sizeof (ut.ut_line));
             strncpy (ut.ut_user, username, sizeof (ut.ut_user));
             if (xdisplay)
@@ -615,9 +618,20 @@ session_child_run (int argc, char **argv)
         if (console_kit_cookie)
         {
             gchar *value;
+            gchar *runtime_dir;
             value = g_strdup_printf ("XDG_SESSION_COOKIE=%s", console_kit_cookie);
             pam_putenv (pam_handle, value);
             g_free (value);
+
+            runtime_dir = ck_get_xdg_runtime_dir (console_kit_cookie);
+            if (runtime_dir)
+            {
+                gchar *value;
+                value = g_strdup_printf ("XDG_RUNTIME_DIR=%s", runtime_dir);
+                pam_putenv (pam_handle, value);
+                g_free (value);
+                g_free (runtime_dir);
+            }
         }
     }
 
@@ -690,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);
@@ -715,11 +732,8 @@ session_child_run (int argc, char **argv)
             ut.ut_type = USER_PROCESS;
             ut.ut_pid = child_pid;
             if (xdisplay)
-            {
-                strncpy (ut.ut_line, xdisplay, sizeof (ut.ut_line));
                 strncpy (ut.ut_id, xdisplay, sizeof (ut.ut_id));
-            }
-            else if (tty)
+            if (tty && g_str_has_prefix (tty, "/dev/"))
                 strncpy (ut.ut_line, tty + strlen ("/dev/"), sizeof (ut.ut_line));
             strncpy (ut.ut_user, username, sizeof (ut.ut_user));
             if (xdisplay)
@@ -755,11 +769,8 @@ session_child_run (int argc, char **argv)
             ut.ut_type = DEAD_PROCESS;
             ut.ut_pid = child_pid;
             if (xdisplay)
-            {
-                strncpy (ut.ut_line, xdisplay, sizeof (ut.ut_line));
                 strncpy (ut.ut_id, xdisplay, sizeof (ut.ut_id));
-            }
-            else if (tty)
+            if (tty && g_str_has_prefix (tty, "/dev/"))
                 strncpy (ut.ut_line, tty + strlen ("/dev/"), sizeof (ut.ut_line));
             strncpy (ut.ut_user, username, sizeof (ut.ut_user));
             if (xdisplay)