diff options
author | Hans Petter Jansson <hpj@novell.com> | 2009-04-01 16:13:00 +0000 |
---|---|---|
committer | Hans Petter <hansp@src.gnome.org> | 2009-04-01 16:13:00 +0000 |
commit | a372a1311c03a05d8ecfccda1e129fb06c4bd35d (patch) | |
tree | f33571884cda2efbe9045c9bfb9a18d19a43cdaa /daemon/gdm-session-worker-job.c | |
parent | 5aad7f5de297a7a813748e624c438bda0120f5ea (diff) | |
download | gdm-a372a1311c03a05d8ecfccda1e129fb06c4bd35d.tar.gz |
Bug 568590 - Environment doesn't get passed on to jobs, leading to
2009-04-01 Hans Petter Jansson <hpj@novell.com>
Bug 568590 - Environment doesn't get passed on to jobs, leading
to unlocalized PAM messages.
* daemon/gdm-session-worker-job.c
(listify_hash): Make sure values are not NULL.
(copy_environment_to_hash): New function.
(get_job_environment): Actually copy the environment into the hash
to get passed on to job.
svn path=/trunk/; revision=6800
Diffstat (limited to 'daemon/gdm-session-worker-job.c')
-rw-r--r-- | daemon/gdm-session-worker-job.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/daemon/gdm-session-worker-job.c b/daemon/gdm-session-worker-job.c index bb302458..67234643 100644 --- a/daemon/gdm-session-worker-job.c +++ b/daemon/gdm-session-worker-job.c @@ -119,10 +119,36 @@ listify_hash (const char *key, GPtrArray *env) { char *str; + + if (value == NULL) + value = ""; + str = g_strdup_printf ("%s=%s", key, value); g_ptr_array_add (env, str); } +static void +copy_environment_to_hash (GHashTable *hash) +{ + gchar **env_strv; + gint i; + + env_strv = g_listenv (); + + for (i = 0; env_strv [i]; i++) { + gchar *key = env_strv [i]; + const gchar *value; + + value = g_getenv (key); + if (!value) + continue; + + g_hash_table_insert (hash, g_strdup (key), g_strdup (value)); + } + + g_strfreev (env_strv); +} + static GPtrArray * get_job_environment (GdmSessionWorkerJob *job) { @@ -133,6 +159,7 @@ get_job_environment (GdmSessionWorkerJob *job) /* 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); + copy_environment_to_hash (hash); g_hash_table_insert (hash, g_strdup ("GDM_SESSION_DBUS_ADDRESS"), g_strdup (job->priv->server_address)); |