From c1d493a4012d508507eaf4d6036c3981e8c17ab4 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Wed, 2 Sep 2020 13:50:14 +0100
Subject: [PATCH] wrap: Unify creation of API filesystems

Now that we export each subdirectory of the root separately, there's
nothing to stop us from using the same function in the runtime and
no-runtime cases.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 src/runtime.c | 4 ----
 src/wrap.c    | 6 ++++--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/runtime.c b/src/runtime.c
index 39e84f967..a33585b63 100644
--- a/src/runtime.c
+++ b/src/runtime.c
@@ -3150,10 +3150,6 @@ pv_runtime_bind (PvRuntime *self,
   g_return_val_if_fail (!pv_bwrap_was_finished (bwrap), FALSE);
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-  /* Start with just the root tmpfs (which appears automatically)
-   * and the standard API filesystems */
-  pv_bwrap_add_api_filesystems (bwrap);
-
   if (!bind_runtime (self, bwrap, error))
     return FALSE;
 
diff --git a/src/wrap.c b/src/wrap.c
index c17027ca2..24bb389e9 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -1417,6 +1417,10 @@ main (int argc,
   if (opt_terminal != PV_TERMINAL_TTY)
     flatpak_bwrap_add_arg (bwrap, "--new-session");
 
+  /* Start with just the root tmpfs (which appears automatically)
+   * and the standard API filesystems */
+  pv_bwrap_add_api_filesystems (bwrap);
+
   if (opt_runtime != NULL && opt_runtime[0] != '\0')
     {
       PvRuntimeFlags flags = PV_RUNTIME_FLAGS_NONE;
@@ -1463,8 +1467,6 @@ main (int argc,
 
       g_assert (!is_flatpak_env);
 
-      pv_bwrap_add_api_filesystems (bwrap);
-
       if (!pv_bwrap_bind_usr (bwrap, "/", "/", "/", error))
         goto out;
 
-- 
GitLab