Remove the tmpfs from /tmp is we are mounting / as root
authorRobert Swiecki <swiecki@google.com>
Wed, 23 Mar 2016 16:08:52 +0000 (17:08 +0100)
committerRobert Swiecki <swiecki@google.com>
Wed, 23 Mar 2016 16:08:52 +0000 (17:08 +0100)
mount.c

diff --git a/mount.c b/mount.c
index 2bc5c96f771df332b3b85cf6a3e31ac5dce6f419..461aa7d9ee16550c775533fcd029aee0d525569e 100644 (file)
--- a/mount.c
+++ b/mount.c
@@ -174,7 +174,6 @@ bool mountInitNs(struct nsjconf_t * nsjconf)
                PLOG_E("pivot_root('%s', '%s')", destdir, pivotrootdir);
                return false;
        }
-
        if (umount2("/pivot_root", MNT_DETACH) == -1) {
                PLOG_E("umount2('/pivot_root', MNT_DETACH)");
                return false;
@@ -195,5 +194,12 @@ bool mountInitNs(struct nsjconf_t * nsjconf)
                }
        }
 
+        /*
+         * Remove the tmpfs from /tmp is we are mounting / as root
+         */
+        if (0 == strcmp(nsjconf->chroot, "/")) {
+          umount2(destdir, MNT_DETACH);
+        }
+
        return true;
 }