Skip to content

Commit

Permalink
WSL: Don't fail if MS_SLAVE not working
Browse files Browse the repository at this point in the history
In Windows 10, with WSL, the MS_SLAVE call fails with EINVAL. To
work around this we just ignore that particular failure.
  • Loading branch information
alexlarsson committed Sep 17, 2018
1 parent e7b517f commit 088c24d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bubblewrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 088c24d

Please sign in to comment.