This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Flush buffer before duplicating file descriptor.
[perl5.git]
/
doio.c
diff --git
a/doio.c
b/doio.c
index
cc34733
..
a953d54
100644
(file)
--- 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';
}