about summary refs log tree commit diff
path: root/login
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-20 07:20:07 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-20 07:20:07 +0000
commit00d26929520f517929f59151167080921df4d781 (patch)
tree40c649761de474c13630f6a839ec8917c9a2c75a /login
parent76755a893db097fe66f53f56356f8630a8ef8cb4 (diff)
downloadglibc-00d26929520f517929f59151167080921df4d781.tar.gz
glibc-00d26929520f517929f59151167080921df4d781.tar.xz
glibc-00d26929520f517929f59151167080921df4d781.zip
[BZ #4813]
* login/forkpty.c (forkpty): Close master and slave fds on 
fork failure.  Patch by 
Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>.
2007-07-20  Jakub Jelinek  <jakub@redhat.com>

	[BZ #4813]
	* login/forkpty.c (forkpty): Close master and slave fds on
	fork failure.  Patch by
	Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>.
Diffstat (limited to 'login')
-rw-r--r--login/forkpty.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/login/forkpty.c b/login/forkpty.c
index ff87fd031d..ccd5dbfe0e 100644
--- a/login/forkpty.c
+++ b/login/forkpty.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
 
@@ -38,6 +38,8 @@ forkpty (amaster, name, termp, winp)
   switch (pid = fork ())
     {
     case -1:
+      close (master);
+      close (slave);
       return -1;
     case 0:
       /* Child.  */