From d065b38e028fbc52ec2ccb2d199f31ccd4abd2d4 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Wed, 20 May 2020 18:49:25 +0100
Subject: [PATCH] runtime: Remove dead code

The entire setup for this call to `readlink -f` should have been removed
when it was hoisted further up in bind_runtime() (and replaced with
`readlink -e`) during commit 26b3be64, but in fact only the part that
actually *ran* the wrapped readlink command was deleted.

This also always leaked some memory.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 src/runtime.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/src/runtime.c b/src/runtime.c
index 180358dfa..dceb56283 100644
--- a/src/runtime.c
+++ b/src/runtime.c
@@ -1443,25 +1443,6 @@ pv_runtime_use_host_graphics_stack (PvRuntime *self,
 
               ld_so_in_host = flatpak_canonicalize_filename (ld_so);
               g_debug ("Host path: %s -> %s", ld_so, ld_so_in_host);
-
-              g_clear_pointer (&temp_bwrap, flatpak_bwrap_free);
-
-              temp_bwrap = flatpak_bwrap_new (NULL);
-              flatpak_bwrap_add_args (temp_bwrap,
-                                      self->bubblewrap,
-                                      NULL);
-
-              if (!pv_bwrap_bind_usr (temp_bwrap,
-                                      self->source_files,
-                                      "/",
-                                      error))
-                return FALSE;
-
-              flatpak_bwrap_add_args (temp_bwrap,
-                                      "readlink", "-f", ld_so,
-                                      NULL);
-              flatpak_bwrap_finish (temp_bwrap);
-
               g_debug ("Container path: %s -> %s", ld_so, ld_so_in_runtime);
               flatpak_bwrap_add_args (bwrap,
                                       "--ro-bind", ld_so_in_host,
@@ -1470,6 +1451,7 @@ pv_runtime_use_host_graphics_stack (PvRuntime *self,
 
               /* Collect miscellaneous libraries that libc might dlopen.
                * At the moment this is just libidn2. */
+              g_assert (temp_bwrap == NULL);
               temp_bwrap = pv_bwrap_copy (self->container_access_adverb);
               flatpak_bwrap_add_args (temp_bwrap,
                                       tool_path,
-- 
GitLab