]> git.proxmox.com Git - mirror_lxcfs.git/blobdiff - lxcfs.c
Better detect the cgmanager version
[mirror_lxcfs.git] / lxcfs.c
diff --git a/lxcfs.c b/lxcfs.c
index 4031faf16798128f05d98fe7932817e4358d4dbf..d6fb101b8a33bec4642c20db2baf7927a21f3f2a 100644 (file)
--- a/lxcfs.c
+++ b/lxcfs.c
@@ -1717,6 +1717,11 @@ static long int get_pid1_time(pid_t pid)
        if (unshare(CLONE_NEWNS))
                return 0;
 
+       if (mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL)) {
+               perror("rslave mount failed");
+               return 0;
+       }
+
        sprintf(fnam, "/proc/%d/ns/pid", pid);
        fd = open(fnam, O_RDONLY);
        if (fd < 0) {
@@ -2136,11 +2141,6 @@ int main(int argc, char *argv[])
        if (!cgm_get_controllers(&d->subsystems))
                return -1;
 
-       if (mount(NULL, "/", NULL, MS_REC|MS_SLAVE, 0) < 0) {
-               perror("Failed to re-mount / non-shared");
-               return -1;
-       }
-
        ret = fuse_main(argc, argv, &lxcfs_ops, d);
 
        return ret;