summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2016-12-09 13:16:07 +1300
committerRobert Ancell <robert.ancell@canonical.com>2016-12-09 13:16:07 +1300
commit085a229b9255db3c54e8cc0386805899d1097a9e (patch)
tree8cfa8d4901716d663d69d9c9db8623804195de16
parentd516731ec6f11052b198f84e83af3c382e48d817 (diff)
downloadlightdm-git-085a229b9255db3c54e8cc0386805899d1097a9e.tar.gz
Don't try and copy environment variables that don't exist
-rw-r--r--src/seat.c15
-rw-r--r--src/x-server-local.c9
2 files changed, 16 insertions, 8 deletions
diff --git a/src/seat.c b/src/seat.c
index db1ff537..34d26940 100644
--- a/src/seat.c
+++ b/src/seat.c
@@ -365,9 +365,12 @@ run_script (Seat *seat, DisplayServer *display_server, const gchar *script_name,
process_set_clear_environment (script, TRUE);
process_set_env (script, "SHELL", "/bin/sh");
- process_set_env (script, "LD_PRELOAD", g_getenv ("LD_PRELOAD"));
- process_set_env (script, "LD_LIBRARY_PATH", g_getenv ("LD_LIBRARY_PATH"));
- process_set_env (script, "PATH", g_getenv ("PATH"));
+ if (g_getenv ("LD_PRELOAD"))
+ process_set_env (script, "LD_PRELOAD", g_getenv ("LD_PRELOAD"));
+ if (g_getenv ("LD_LIBRARY_PATH"))
+ process_set_env (script, "LD_LIBRARY_PATH", g_getenv ("LD_LIBRARY_PATH"));
+ if (g_getenv ("PATH"))
+ process_set_env (script, "PATH", g_getenv ("PATH"));
/* Variables required for regression tests */
if (g_getenv ("LIGHTDM_TEST_ROOT"))
@@ -895,8 +898,10 @@ set_session_env (Session *session)
session_set_env (session, "GI_TYPELIB_PATH", g_getenv ("GI_TYPELIB_PATH"));
}
- session_set_env (session, "LD_PRELOAD", g_getenv ("LD_PRELOAD"));
- session_set_env (session, "LD_LIBRARY_PATH", g_getenv ("LD_LIBRARY_PATH"));
+ if (g_getenv ("LD_PRELOAD"))
+ session_set_env (session, "LD_PRELOAD", g_getenv ("LD_PRELOAD"));
+ if (g_getenv ("LD_LIBRARY_PATH"))
+ session_set_env (session, "LD_LIBRARY_PATH", g_getenv ("LD_LIBRARY_PATH"));
}
static Session *
diff --git a/src/x-server-local.c b/src/x-server-local.c
index 58a02b60..0efc42a0 100644
--- a/src/x-server-local.c
+++ b/src/x-server-local.c
@@ -550,9 +550,12 @@ x_server_local_start (DisplayServer *display_server)
}
/* Pass through library variables */
- process_set_env (server->priv->x_server_process, "LD_PRELOAD", g_getenv ("LD_PRELOAD"));
- process_set_env (server->priv->x_server_process, "LD_LIBRARY_PATH", g_getenv ("LD_LIBRARY_PATH"));
- process_set_env (server->priv->x_server_process, "PATH", g_getenv ("PATH"));
+ if (g_getenv ("LD_PRELOAD"))
+ process_set_env (server->priv->x_server_process, "LD_PRELOAD", g_getenv ("LD_PRELOAD"));
+ if (g_getenv ("LD_LIBRARY_PATH"))
+ process_set_env (server->priv->x_server_process, "LD_LIBRARY_PATH", g_getenv ("LD_LIBRARY_PATH"));
+ if (g_getenv ("PATH"))
+ process_set_env (server->priv->x_server_process, "PATH", g_getenv ("PATH"));
/* Variable required for regression tests */
process_set_env (server->priv->x_server_process, "LIGHTDM_TEST_ROOT", g_getenv ("LIGHTDM_TEST_ROOT"));