Re: bleadperl: PerlIOStdio_invalidate_fileno breaks fclose semantics
authorNick Ing-Simmons <nik@tiuk.ti.com>
Sat, 1 Feb 2003 13:03:52 +0000 (13:03 +0000)
committerAbhijit Menon-Sen <ams@wiw.org>
Sat, 1 Feb 2003 12:00:29 +0000 (12:00 +0000)
Message-Id: <20030201130352.1872.12@bactrian.ni-s.u-net.com>

p4raw-id: //depot/perl@18614

perlio.c

index a9228b4766066684cca77a204a8489f1a1c16dfb..c22af6b540ec4d648ed833c73395a341f2c54faf 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -2795,7 +2795,7 @@ PerlIOStdio_close(pTHX_ PerlIO *f)
         int fd = fileno(stdio);
        int socksfd = 0;
        int invalidate = 0;
-       IV result;
+       IV result = 0;
        int saveerr = 0;
        int dupfd = 0;
 #ifdef SOCKS5_VERSION_NAME
@@ -2830,6 +2830,7 @@ PerlIOStdio_close(pTHX_ PerlIO *f)
               Use Sarathy's trick from maint-5.6 to invalidate the 
               fileno slot of the FILE * 
            */ 
+           result = PerlIO_flush(f);
            saveerr = errno;
            if (!(invalidate = PerlIOStdio_invalidate_fileno(aTHX_ stdio))) {
                dupfd = PerlLIO_dup(fd);