From: Benjamin Sugars Date: Mon, 26 Mar 2001 13:29:54 +0000 (-0500) Subject: socket() leaks file descriptors X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=571714202f6d2012220ed718d95c0404dd890ea5;p=p5sagit%2Fp5-mst-13.2.git socket() leaks file descriptors Message-ID: Also sockpair() fixed similarly. p4raw-id: //depot/perl@9363 --- diff --git a/pp_sys.c b/pp_sys.c index 922fb28..d6266dc 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -2205,6 +2205,9 @@ PP(pp_socket) RETPUSHUNDEF; } + if (IoIFP(io)) + do_close(gv, FALSE); + TAINT_PROPER("socket"); fd = PerlSock_socket(domain, type, protocol); if (fd < 0) @@ -2263,6 +2266,9 @@ PP(pp_sockpair) RETPUSHUNDEF; } + if (IoIFP(io)) + do_close(gv, FALSE); + TAINT_PROPER("socketpair"); if (PerlSock_socketpair(domain, type, protocol, fd) < 0) RETPUSHUNDEF;