mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Close slave on fork error to prevent pty fd leak.
CID: 978209
This commit is contained in:
parent
076950009f
commit
7e8fba7889
1 changed files with 2 additions and 1 deletions
|
|
@ -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 a new issue