coredump fix in pp_accept()
authorAnton Berezin <tobez@tobez.org>
Wed, 17 Oct 2001 18:25:48 +0000 (20:25 +0200)
committerAbhijit Menon-Sen <ams@wiw.org>
Wed, 17 Oct 2001 18:50:55 +0000 (18:50 +0000)
Message-Id: <20011017182548.A12082@heechee.tobez.org>

p4raw-id: //depot/perl@12478

pp_sys.c

index b241a0e..ae1baa5 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2464,12 +2464,11 @@ PP(pp_accept)
        goto nuts;
 
     nstio = GvIOn(ngv);
-    if (IoIFP(nstio))
-       do_close(ngv, FALSE);
-
     fd = PerlSock_accept(PerlIO_fileno(IoIFP(gstio)), (struct sockaddr *)&saddr, &len);
     if (fd < 0)
        goto badexit;
+    if (IoIFP(nstio))
+       do_close(ngv, FALSE);
     IoIFP(nstio) = PerlIO_fdopen(fd, "r");
     IoOFP(nstio) = PerlIO_fdopen(fd, "w");
     IoTYPE(nstio) = IoTYPE_SOCKET;