diff --git a/src/container.c b/src/container.c index 80e75d1..cd699e8 100644 --- a/src/container.c +++ b/src/container.c @@ -411,6 +411,8 @@ int hyper_start_container(struct hyper_container *container) goto fail; } + container->exec.pid = pid; + /* wait for ready message */ if (hyper_get_type_block(arg.pipe[0], &type) < 0 || type != READY) { fprintf(stdout, "wait for container started failed\n"); @@ -420,7 +422,6 @@ int hyper_start_container(struct hyper_container *container) close(arg.pipe[0]); close(arg.pipe[1]); - container->exec.pid = pid; fprintf(stdout, "container %s init pid is %d\n", container->id, pid); return 0; diff --git a/src/exec.c b/src/exec.c index 85cc927..c54357d 100644 --- a/src/exec.c +++ b/src/exec.c @@ -132,7 +132,7 @@ int hyper_dup_exec_tty(int to, struct hyper_exec *e) return -1; } - if (ioctl(fd, TIOCSCTTY, NULL) < 0) { + if (e->seq && (ioctl(fd, TIOCSCTTY, NULL) < 0)) { perror("ioctl pty device for execcmd failed"); return -1; }