diff --git a/src/container.c b/src/container.c index 18f449ec..3eb041f7 100644 --- a/src/container.c +++ b/src/container.c @@ -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) || diff --git a/src/init.c b/src/init.c index df67fc32..4b6becb6 100644 --- a/src/init.c +++ b/src/init.c @@ -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; } @@ -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();