Skip to content

Commit

Permalink
build: Handle setting LD_LIBRARY_PATH when bwrap is setuid
Browse files Browse the repository at this point in the history
We need to pass LD_LIBRARY_PATH as --setennv, because the setuid
helper strips that. We did this already for run, but this moves it
so its used by build too.
  • Loading branch information
alexlarsson committed May 26, 2016
1 parent 282709d commit bde6fa5
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions common/flatpak-run.c
Expand Up @@ -1877,6 +1877,14 @@ flatpak_run_add_environment_args (GPtrArray *argv_array,
!unrestricted_system_bus && system_bus_proxy_argv)
flatpak_add_bus_filters (system_bus_proxy_argv, context->system_bus_policy, NULL, context);

if (g_environ_getenv (*envp_p, "LD_LIBRARY_PATH") != NULL)
{
/* LD_LIBRARY_PATH is overridden for setuid helper, so pass it as cmdline arg */
add_args (argv_array,
"--setenv", "LD_LIBRARY_PATH", g_environ_getenv (*envp_p, "LD_LIBRARY_PATH"),
NULL);
*envp_p = g_environ_unsetenv (*envp_p, "LD_LIBRARY_PATH");
}
}

static const struct {const char *env;
Expand Down Expand Up @@ -3036,15 +3044,6 @@ flatpak_run_app (const char *app_ref,
"--symlink", "/usr/lib/debug/source", "/run/build-runtime",
NULL);

if (g_environ_getenv (envp, "LD_LIBRARY_PATH") != NULL)
{
/* LD_LIBRARY_PATH is overridden for setuid helper, so pass it as cmdline arg */
add_args (argv_array,
"--setenv", "LD_LIBRARY_PATH", g_environ_getenv (envp, "LD_LIBRARY_PATH"),
NULL);
envp = g_environ_unsetenv (envp, "LD_LIBRARY_PATH");
}

if (custom_command)
{
command = custom_command;
Expand Down

0 comments on commit bde6fa5

Please sign in to comment.