Close slave on fork error to prevent pty fd leak.
CID: 978209
This commit is contained in:
parent
076950009f
commit
7e8fba7889
@ -101,12 +101,13 @@ forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp)
|
||||
return (-1);
|
||||
switch (pid = fork()) {
|
||||
case -1:
|
||||
(void)close(slave);
|
||||
return (-1);
|
||||
case 0:
|
||||
/*
|
||||
* child
|
||||
*/
|
||||
(void) close(master);
|
||||
(void)close(master);
|
||||
login_tty(slave);
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user