From 6deea16f8ec760909fc496bd7dd73276ca3b4c45 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Tue, 23 Feb 2021 18:13:23 +0000
Subject: [PATCH] runtime: Check consistency of arguments for Flatpak
 subsandbox

Flatpak subsandboxes don't have sufficiently powerful control over
the container to use bubblewrap or FlatpakExports directly.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 pressure-vessel/runtime.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/pressure-vessel/runtime.c b/pressure-vessel/runtime.c
index 8f8807993..8da0c0317 100644
--- a/pressure-vessel/runtime.c
+++ b/pressure-vessel/runtime.c
@@ -4509,6 +4509,17 @@ pv_runtime_bind (PvRuntime *self,
   g_return_val_if_fail (container_env != NULL, FALSE);
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
+  if (self->flags & PV_RUNTIME_FLAGS_FLATPAK_SUBSANDBOX)
+    {
+      g_return_val_if_fail (exports == NULL, FALSE);
+      g_return_val_if_fail (bwrap == NULL, FALSE);
+    }
+  else
+    {
+      g_return_val_if_fail (exports != NULL, FALSE);
+      g_return_val_if_fail (bwrap != NULL, FALSE);
+    }
+
   if (bwrap != NULL
       && !bind_runtime_base (self, bwrap, container_env, error))
     return FALSE;
-- 
GitLab