X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=doio.c;h=a953d54dd21bc42731627fd70be104dd8cc2d6ba;hb=b0ce926a45891e83ffb4badae874161f93c0eb49;hp=cc347331a2b5360416b98d0eb5af574ae671a587;hpb=d8a83dd3ecf2b61bda27d39770e9942db2eb1719;p=p5sagit%2Fp5-mst-13.2.git diff --git a/doio.c b/doio.c index cc34733..a953d54 100644 --- a/doio.c +++ b/doio.c @@ -282,7 +282,10 @@ Perl_do_open9(pTHX_ GV *gv, register char *name, I32 len, int as_raw, goto say_false; } if (IoIFP(thatio)) { - fd = PerlIO_fileno(IoIFP(thatio)); + PerlIO *fp = IoIFP(thatio); + /* Flush stdio buffer before dup */ + PerlIO_seek(fp, 0, SEEK_CUR); + fd = PerlIO_fileno(fp); if (IoTYPE(thatio) == 's') IoTYPE(io) = 's'; }