Blob Blame History Raw
From c29c4587ffc1ac7b923a2725a9f8fee0579124d1 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 27 Mar 2017 16:56:29 -0400
Subject: [PATCH 03/13] launch-environment: fix crasher when session-mode isn't
 set

This commit fixes a crasher when starting the indirect chooser.
---
 daemon/gdm-launch-environment.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/daemon/gdm-launch-environment.c b/daemon/gdm-launch-environment.c
index a30276b4..4372ac29 100644
--- a/daemon/gdm-launch-environment.c
+++ b/daemon/gdm-launch-environment.c
@@ -128,68 +128,69 @@ build_launch_environment (GdmLaunchEnvironment *launch_environment,
                 "XDG_CONFIG_DIRS", NULL
         };
         char *system_data_dirs;
         int i;
 
         /* create a hash table of current environment, then update keys has necessary */
         hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
 
         for (i = 0; optional_environment[i] != NULL; i++) {
                 if (g_getenv (optional_environment[i]) == NULL) {
                         continue;
                 }
 
                 g_hash_table_insert (hash,
                                      g_strdup (optional_environment[i]),
                                      g_strdup (g_getenv (optional_environment[i])));
         }
 
         system_data_dirs = g_strjoinv (":", (char **) g_get_system_data_dirs ());
 
         g_hash_table_insert (hash,
                              g_strdup ("XDG_DATA_DIRS"),
                              g_strdup_printf ("%s:%s",
                                               DATADIR "/gdm/greeter",
                                               system_data_dirs));
         g_free (system_data_dirs);
 
         if (launch_environment->priv->x11_authority_file != NULL)
                 g_hash_table_insert (hash, g_strdup ("XAUTHORITY"), g_strdup (launch_environment->priv->x11_authority_file));
 
-        if (launch_environment->priv->session_mode != NULL)
+        if (launch_environment->priv->session_mode != NULL) {
                 g_hash_table_insert (hash, g_strdup ("GNOME_SHELL_SESSION_MODE"), g_strdup (launch_environment->priv->session_mode));
 
-        /* Inital setup needs gvfs for fetching remote avatars. */
-        if (strcmp (launch_environment->priv->session_mode, INITIAL_SETUP_SESSION_MODE) != 0) {
-                g_hash_table_insert (hash, g_strdup ("GVFS_DISABLE_FUSE"), g_strdup ("1"));
-                g_hash_table_insert (hash, g_strdup ("GIO_USE_VFS"), g_strdup ("local"));
-                g_hash_table_insert (hash, g_strdup ("GVFS_REMOTE_VOLUME_MONITOR_IGNORE"), g_strdup ("1"));
+		/* Inital setup needs gvfs for fetching remote avatars. */
+		if (strcmp (launch_environment->priv->session_mode, INITIAL_SETUP_SESSION_MODE) != 0) {
+			g_hash_table_insert (hash, g_strdup ("GVFS_DISABLE_FUSE"), g_strdup ("1"));
+			g_hash_table_insert (hash, g_strdup ("GIO_USE_VFS"), g_strdup ("local"));
+			g_hash_table_insert (hash, g_strdup ("GVFS_REMOTE_VOLUME_MONITOR_IGNORE"), g_strdup ("1"));
+		}
         }
 
         g_hash_table_insert (hash, g_strdup ("LOGNAME"), g_strdup (launch_environment->priv->user_name));
         g_hash_table_insert (hash, g_strdup ("USER"), g_strdup (launch_environment->priv->user_name));
         g_hash_table_insert (hash, g_strdup ("USERNAME"), g_strdup (launch_environment->priv->user_name));
 
         g_hash_table_insert (hash, g_strdup ("GDM_VERSION"), g_strdup (VERSION));
         g_hash_table_remove (hash, "MAIL");
 
         g_hash_table_insert (hash, g_strdup ("HOME"), g_strdup ("/"));
         g_hash_table_insert (hash, g_strdup ("PWD"), g_strdup ("/"));
         g_hash_table_insert (hash, g_strdup ("SHELL"), g_strdup ("/bin/sh"));
 
         gdm_get_pwent_for_name (launch_environment->priv->user_name, &pwent);
         if (pwent != NULL) {
                 if (pwent->pw_dir != NULL && pwent->pw_dir[0] != '\0') {
                         g_hash_table_insert (hash, g_strdup ("HOME"), g_strdup (pwent->pw_dir));
                         g_hash_table_insert (hash, g_strdup ("PWD"), g_strdup (pwent->pw_dir));
                 }
 
                 g_hash_table_insert (hash, g_strdup ("SHELL"), g_strdup (pwent->pw_shell));
         }
 
         if (start_session && launch_environment->priv->x11_display_seat_id != NULL) {
                 char *seat_id;
 
                 seat_id = launch_environment->priv->x11_display_seat_id;
 
                 g_hash_table_insert (hash, g_strdup ("GDM_SEAT_ID"), g_strdup (seat_id));
         }
-- 
2.12.0