From 6adf435223a79429532d65f63626322fb04903ad Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Mon, 26 Jul 2021 17:13:36 +0100 Subject: [PATCH] pv-wrap: Hoist ld.so.blockedlist adjustment out of loop We only need to do this once, and it's harmless to do this even if libshared-library-guard isn't even in use, so we might as well move it out of the loops. Signed-off-by: Simon McVittie <smcv@collabora.com> --- pressure-vessel/wrap.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/pressure-vessel/wrap.c b/pressure-vessel/wrap.c index b68f2e86b..87e0cd0d3 100644 --- a/pressure-vessel/wrap.c +++ b/pressure-vessel/wrap.c @@ -2091,6 +2091,23 @@ main (int argc, FLATPAK_FILESYSTEM_MODE_READ_WRITE, "/tmp"); + if (flatpak_subsandbox != NULL) + { + /* We special case libshared-library-guard because usually + * its blockedlist file is located in `/app` and we need + * to change that to the `/run/parent` counterpart */ + const gchar *blockedlist = "/app/etc/freedesktop-sdk.ld.so.blockedlist"; + + if (g_file_test (blockedlist, G_FILE_TEST_EXISTS)) + { + g_autofree gchar *adjusted_blockedlist = NULL; + adjusted_blockedlist = g_build_filename ("/run/parent", + blockedlist, NULL); + pv_environ_setenv (container_env, "SHARED_LIBRARY_GUARD_CONFIG", + adjusted_blockedlist); + } + } + adverb_preload_argv = g_ptr_array_new_with_free_func (g_free); /* We need the LD_PRELOADs from Steam visible at the paths that were @@ -2153,22 +2170,6 @@ main (int argc, g_strdup_printf ("%s=%s", option, adjusted_path)); - - if (g_str_has_suffix (preload, "/libshared-library-guard.so")) - { - /* We special case libshared-library-guard because usually - * its blockedlist file is located in `/app` and we need - * to change that to the `/run/parent` counterpart */ - const gchar *blockedlist = "/app/etc/freedesktop-sdk.ld.so.blockedlist"; - if (g_file_test (blockedlist, G_FILE_TEST_EXISTS)) - { - g_autofree gchar *adjusted_blockedlist = NULL; - adjusted_blockedlist = g_build_filename ("/run/parent", - blockedlist, NULL); - pv_environ_setenv (container_env, "SHARED_LIBRARY_GUARD_CONFIG", - adjusted_blockedlist); - } - } } else { -- GitLab