Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,12 @@ static int container_setup_mount(struct hyper_container *container)
return -1;
}

if (unlink("./dev/ptmx") < 0) {
perror("remove /dev/ptmx failed");
return -1;
}
if (symlink("/dev/pts/ptmx", "./dev/ptmx") < 0) {
/* all containers share the same devtmpfs, so we need to ignore the errno EEXIST */
if (symlink("/dev/pts/ptmx", "./dev/ptmx") < 0 && errno != EEXIST) {
perror("link /dev/pts/ptmx to /dev/ptmx failed");
return -1;
}

/* all containers share the same devtmpfs, so we need to ignore the errno EEXIST */
if ((symlink("/proc/self/fd", "./dev/fd") < 0 && errno != EEXIST) ||
(symlink("/proc/self/fd/0", "./dev/stdin") < 0 && errno != EEXIST) ||
(symlink("/proc/self/fd/1", "./dev/stdout") < 0 && errno != EEXIST) ||
Expand Down
15 changes: 12 additions & 3 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,9 @@ static int hyper_setup_shared(struct hyper_pod *pod)

static int hyper_setup_pod(struct hyper_pod *pod)
{
/* create tmp proc directory */
if (hyper_mkdir("/tmp/hyper/proc", 0755) < 0) {
perror("create tmp proc failed");
/* create sandbox directory */
if (hyper_mkdir("/tmp/hyper", 0755) < 0) {
perror("create sandbox directory failed");
return -1;
}

Expand Down Expand Up @@ -1380,6 +1380,15 @@ int main(int argc, char *argv[])
return -1;
}

if (unlink("/dev/ptmx") < 0) {
perror("remove /dev/ptmx failed");
return -1;
}
if (symlink("/dev/pts/ptmx", "/dev/ptmx") < 0) {
perror("link /dev/pts/ptmx to /dev/ptmx failed");
return -1;
}

cmdline = read_cmdline();

setsid();
Expand Down