mirror of
https://github.com/flatpak/flatpak.git
synced 2026-03-15 21:52:08 -04:00
More special casing of LD_LIBRARY_PATH
* Convert LD_LIBRARY_PATH in [Vars] to _LD_LIBRARY_PATH in the env so that its properly propagated. * Always unset the regular LD_LIBRARY_PATH in the app if _LD_LIBRARY_PATH is unset. * Always unset LD_LIBRARY_PATH as passed to the helper to avoid it getting some weird effect.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user