[gnome-session: 1/2] util: Add session env variables to child env



commit ff9e91f8b17192ff730a6ecb64dc76bfc1d27c83
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Mon Feb 11 18:45:02 2019 +0100

    util: Add session env variables to child env
    
    GNOME Session does not replicate all the environment variables to its children
    while it sets them as activation environment for both DBUs and Systemd.
    
    This is causing the g-s child not to use pre-set variables such as XDG_RUNTIME_DIR
    for launching its children such as the whale dialog.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-session/issues/15

 gnome-session/gsm-util.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/gnome-session/gsm-util.c b/gnome-session/gsm-util.c
index adc62be9..dc0f138d 100644
--- a/gnome-session/gsm-util.c
+++ b/gnome-session/gsm-util.c
@@ -523,6 +523,10 @@ gsm_util_export_activation_environment (GError     **error)
                 return FALSE;
         }
 
+        if (child_environment == NULL) {
+                child_environment = g_listenv ();
+        }
+
         g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{ss}"));
         for (entry_names = g_listenv (); entry_names[i] != NULL; i++) {
                 const char *entry_name = entry_names[i];
@@ -540,6 +544,9 @@ gsm_util_export_activation_environment (GError     **error)
                 if (!g_regex_match (value_regex, entry_value, 0, NULL))
                     continue;
 
+                child_environment = g_environ_setenv (child_environment,
+                                                      entry_name, entry_value,
+                                                      TRUE);
                 g_variant_builder_add (&builder, "{ss}", entry_name, entry_value);
         }
         g_regex_unref (name_regex);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]