summaryrefslogtreecommitdiff
path: root/pppd/tty.c
diff options
context:
space:
mode:
authorFrank Cusack <fcusack@fcusack.com>2003-02-24 11:29:53 +0000
committerFrank Cusack <fcusack@fcusack.com>2003-02-24 11:29:53 +0000
commite2df1fe10f6940329cbb2fe1e05b18247a005456 (patch)
treee5662330b4abdb0d827e4042f32062c7f034125d /pppd/tty.c
parenta870eea56e6587ed50714ee06a5469b45869b168 (diff)
downloadppp-e2df1fe10f6940329cbb2fe1e05b18247a005456.tar.gz
Don't leak an extra pipe descriptor to ptycommand. Bug report by Steve Grubb.
Diffstat (limited to 'pppd/tty.c')
-rw-r--r--pppd/tty.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/pppd/tty.c b/pppd/tty.c
index efc92ec..a7ebe6f 100644
--- a/pppd/tty.c
+++ b/pppd/tty.c
@@ -73,7 +73,7 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define RCSID "$Id: tty.c,v 1.9 2002/12/06 12:06:45 paulus Exp $"
+#define RCSID "$Id: tty.c,v 1.10 2003/02/24 11:29:53 fcusack Exp $"
#include <stdio.h>
#include <ctype.h>
@@ -614,6 +614,11 @@ int connect_tty()
if (pipe(ipipe) < 0 || pipe(opipe) < 0)
fatal("Couldn't create pipes for record option: %m");
+
+ /* don't leak these to the ptycommand */
+ (void) fcntl(ipipe[0], F_SETFD, FD_CLOEXEC);
+ (void) fcntl(opipe[1], F_SETFD, FD_CLOEXEC);
+
ok = device_script(ptycommand, opipe[0], ipipe[1], 1) == 0
&& start_charshunt(ipipe[0], opipe[1]);
close(ipipe[0]);