diff --git a/xdg-app-helper.c b/xdg-app-helper.c index 8b4ffdc6..ec3fc1a6 100644 --- a/xdg-app-helper.c +++ b/xdg-app-helper.c @@ -1867,6 +1867,8 @@ main (int argc, xsetenv ("LD_LIBRARY_PATH", getenv("_LD_LIBRARY_PATH"), 1); xunsetenv ("_LD_LIBRARY_PATH"); } + else + xunsetenv ("LD_LIBRARY_PATH"); xdg_runtime_dir = strdup_printf ("/run/user/%d", getuid()); xsetenv ("XDG_RUNTIME_DIR", xdg_runtime_dir, 1); diff --git a/xdg-app-run.c b/xdg-app-run.c index 52b4a07b..3fdcc836 100644 --- a/xdg-app-run.c +++ b/xdg-app-run.c @@ -307,6 +307,7 @@ xdg_app_run_add_environment_args (GPtrArray *argv_array, static const struct {const char *env; const char *val;} default_exports[] = { {"PATH","/self/bin:/usr/bin"}, + {"LD_LIBRARY_PATH", ""}, {"_LD_LIBRARY_PATH", "/self/lib"}, {"XDG_CONFIG_DIRS","/self/etc/xdg:/etc/xdg"}, {"XDG_DATA_DIRS","/self/share:/usr/share"}, @@ -434,6 +435,12 @@ xdg_app_run_apply_env_vars (char **envp, GKeyFile *metakey) { const char *key = keys[i]; g_autofree char *value = g_key_file_get_string (metakey, "Vars", key, NULL); + + /* We special case LD_LIBRARY_PATH to avoid passing it top + the helper */ + if (strcmp (key, "LD_LIBRARY_PATH") == 0) + key = "_LD_LIBRARY_PATH"; + if (value) envp = g_environ_setenv (envp, key, value, TRUE); else