Bug 4813 - forkpty() leaks file handles
Summary: forkpty() leaks file handles
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P1 minor
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-19 02:02 UTC by Mikulas Patocka
Modified: 2014-07-04 16:11 UTC (History)
1 user (show)

See Also:
Host: i686-linux-gnu
Target: i686-linux-gnu
Build: i686-linux-gnu
Last reconfirmed:
fweimer: security-


Attachments
patch to close file descriptors on fork() error (170 bytes, patch)
2007-07-19 02:04 UTC, Mikulas Patocka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikulas Patocka 2007-07-19 02:02:41 UTC
When fork() inside forkpty() fails with an error, forkpty() leaves two open file
handles. The handles are not stored anywhere and are not closed.
Comment 1 Mikulas Patocka 2007-07-19 02:04:57 UTC
Created attachment 1920 [details]
patch to close file descriptors on fork() error
Comment 2 Sourceware Commits 2007-07-20 07:20:21 UTC
Subject: Bug 4813

CVSROOT:	/cvs/glibc
Module name:	libc
Changes by:	jakub@sourceware.org	2007-07-20 07:20:07

Modified files:
	.              : ChangeLog 
	login          : forkpty.c 

Log message:
	[BZ #4813]
	* login/forkpty.c (forkpty): Close master and slave fds on
	fork failure.  Patch by
	Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/ChangeLog.diff?cvsroot=glibc&r1=1.10709&r2=1.10710
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/login/forkpty.c.diff?cvsroot=glibc&r1=1.2&r2=1.3

Comment 3 Jakub Jelinek 2007-07-20 07:21:08 UTC
Fixed in CVS.