summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexander.larsson@gmail.com>2018-09-14 11:21:21 +0100
committerAlexander Larsson <alexl@redhat.com>2018-09-17 11:08:39 +0200
commit088c24d1d50774923341a9086fa86565686c1ceb (patch)
tree24d64480d139f9b28475bff8bedcb6be26ccdb5a
parente7b517f40956a153972fd61a2c6da1140f52990b (diff)
downloadbubblewrap-088c24d1d50774923341a9086fa86565686c1ceb.tar.gz
WSL: Don't fail if MS_SLAVE not working
In Windows 10, with WSL, the MS_SLAVE call fails with EINVAL. To work around this we just ignore that particular failure.
-rw-r--r--bubblewrap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bubblewrap.c b/bubblewrap.c
index b319f1c..f70a425 100644
--- a/bubblewrap.c
+++ b/bubblewrap.c
@@ -2297,8 +2297,10 @@ main (int argc,
/* Mark everything as slave, so that we still
* receive mounts from the real root, but don't
- * propagate mounts to the real root. */
- if (mount (NULL, "/", NULL, MS_SLAVE | MS_REC, NULL) < 0)
+ * propagate mounts to the real root.
+ * Note: WSL doesn't support this, so if EINVAL, just ignore the failure. */
+ if ((mount (NULL, "/", NULL, MS_SLAVE | MS_REC, NULL) < 0) &&
+ errno != EINVAL)
die_with_error ("Failed to make / slave");
/* Create a tmpfs which we will use as / in the namespace */