Integrate changes #9493,9494,9495,9496 from maintperl
[p5sagit/p5-mst-13.2.git] / pp_sys.c
index dc070f8..3285574 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2192,6 +2192,9 @@ PP(pp_socket)
        RETPUSHUNDEF;
     }
 
+    if (IoIFP(io))
+       do_close(gv, FALSE);
+
     TAINT_PROPER("socket");
     fd = PerlSock_socket(domain, type, protocol);
     if (fd < 0)
@@ -2250,6 +2253,11 @@ PP(pp_sockpair)
        RETPUSHUNDEF;
     }
 
+    if (IoIFP(io1))
+       do_close(gv1, FALSE);
+    if (IoIFP(io2))
+       do_close(gv2, FALSE);
+
     TAINT_PROPER("socketpair");
     if (PerlSock_socketpair(domain, type, protocol, fd) < 0)
        RETPUSHUNDEF;