Browse Source

Fix pty descriptor leak if fork() fails.

ok millert
OPENBSD_5_4
matthew 11 years ago
parent
commit
c01980f9dc
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      src/lib/libutil/pty.c

+ 3
- 1
src/lib/libutil/pty.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: pty.c,v 1.18 2012/12/05 23:20:06 deraadt Exp $ */
/* $OpenBSD: pty.c,v 1.19 2013/05/21 19:07:02 matthew Exp $ */
/*- /*-
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@ -89,6 +89,8 @@ forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp)
return (-1); return (-1);
switch (pid = fork()) { switch (pid = fork()) {
case -1: case -1:
(void) close(master);
(void) close(slave);
return (-1); return (-1);
case 0: case 0:
/* /*


Loading…
Cancel
Save