close ptymaster when failed

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
This commit is contained in:
Lai Jiangshan
2016-09-23 23:25:13 +08:00
parent 56198c3acd
commit da72799c96
+2
View File
@@ -386,11 +386,13 @@ static int hyper_setup_exec_tty(struct hyper_exec *e)
if (ioctl(ptymaster, TIOCSPTLCK, &unlock) < 0) {
perror("ioctl unlock ptmx device failed");
close(ptymaster);
return -1;
}
if (ioctl(ptymaster, TIOCGPTN, &e->ptyno) < 0) {
perror("ioctl get execcmd pty device failed");
close(ptymaster);
return -1;
}