socket() leaks file descriptors
authorBenjamin Sugars <bsugars@canoe.ca>
Mon, 26 Mar 2001 13:29:54 +0000 (08:29 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Mon, 26 Mar 2001 18:44:32 +0000 (18:44 +0000)
Message-ID: <Pine.LNX.4.21.0103261315510.2729-100000@marmot.rim.canoe.ca>

Also sockpair() fixed similarly.

p4raw-id: //depot/perl@9363

pp_sys.c

index 922fb28..d6266dc 100644 (file)
--- 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;