summaryrefslogtreecommitdiff
path: root/cmd/snap-confine
diff options
authorMaciej Borzecki <maciej.zenon.borzecki@canonical.com>2019-09-09 11:19:49 +0200
committerMaciej Borzecki <maciej.zenon.borzecki@canonical.com>2019-09-09 11:19:49 +0200
commitb81d811fa4203626d20155ff046ec0bdcd60b41c (patch)
tree48919274d67446d3bdb99ec9c6bec688d3dfa5f3 /cmd/snap-confine
parente5dd66ea3841ad2c17d35a6e74078fa756cac80a (diff)
parent6e216411fca8c94b472be18ebe6ae42c15a4a16c (diff)
Merge remote-tracking branch 'upstream/master' into bboozzoo/s-c-invocation-tests
Diffstat (limited to 'cmd/snap-confine')
-rw-r--r--cmd/snap-confine/mount-support.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/cmd/snap-confine/mount-support.c b/cmd/snap-confine/mount-support.c
index 5a58323e8e..411fbd4598 100644
--- a/cmd/snap-confine/mount-support.c
+++ b/cmd/snap-confine/mount-support.c
@@ -406,10 +406,14 @@ static void sc_bootstrap_mount_namespace(const struct sc_mount_config *config)
// the this directory on the host filesystem may not match the location in
// the desired root filesystem. In the "core" and "ubuntu-core" snaps the
// directory is always /snap. On the host it is a build-time configuration
- // option stored in SNAP_MOUNT_DIR.
- sc_must_snprintf(dst, sizeof dst, "%s/snap", scratch_dir);
- sc_do_mount(SNAP_MOUNT_DIR, dst, NULL, MS_BIND | MS_REC, NULL);
- sc_do_mount("none", dst, NULL, MS_REC | MS_SLAVE, NULL);
+ // option stored in SNAP_MOUNT_DIR. In legacy mode (or in other words, not
+ // in normal mode), we don't need to do this because /snap is fixed and
+ // already contains the correct view of the mounted snaps.
+ if (config->normal_mode) {
+ sc_must_snprintf(dst, sizeof dst, "%s/snap", scratch_dir);
+ sc_do_mount(SNAP_MOUNT_DIR, dst, NULL, MS_BIND | MS_REC, NULL);
+ sc_do_mount("none", dst, NULL, MS_REC | MS_SLAVE, NULL);
+ }
// Create the hostfs directory if one is missing. This directory is a part
// of packaging now so perhaps this code can be removed later.
if (access(SC_HOSTFS_DIR, F_OK) != 0) {