Commit 4dd0735f authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Andrei Vagin

restore: Save some time mounting proc

When restoring w/o namespaces it doesn't make sence to
mount /proc by hands and detach it. We can just use the
host-side one.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 31cde250
......@@ -1249,6 +1249,9 @@ static int mount_proc(void)
int fd, ret;
char proc_mountpoint[] = "crtools-proc.XXXXXX";
if (root_ns_mask == 0)
fd = ret = open("/proc", O_DIRECTORY);
else {
if (mkdtemp(proc_mountpoint) == NULL) {
pr_perror("mkdtemp failed %s", proc_mountpoint);
return -1;
......@@ -1262,6 +1265,8 @@ static int mount_proc(void)
}
ret = fd = open_detach_mount(proc_mountpoint);
}
if (fd >= 0) {
ret = set_proc_fd(fd);
close(fd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment