remove /old_root on --pivot_root_only
authorStephen Röttger <stephen.roettger@gmail.com>
Sun, 25 Sep 2016 12:48:39 +0000 (14:48 +0200)
committerStephen Röttger <sroettger@google.com>
Fri, 30 Sep 2016 14:30:59 +0000 (16:30 +0200)
mount.c

diff --git a/mount.c b/mount.c
index 97a50a0fb01f683479970999de0d7c27d568df61..d719e6675b57e589b63948bdf56c32b5453c2ba6 100644 (file)
--- a/mount.c
+++ b/mount.c
@@ -219,6 +219,11 @@ static bool mountInitNsInternal(struct nsjconf_t *nsjconf)
                        PLOG_E("chroot('%s')", newrootdir);
                        return false;
                }
+       } else {
+               if (rmdir("/old_root") == -1) {
+                       PLOG_E("rmdir('/old_root')");
+                       return false;
+               }
        }
 
        if (chdir(nsjconf->cwd) == -1) {