https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81751
--- Comment #7 from Jonathan Wakely ---
Author: redi
Date: Wed Aug 9 17:52:10 2017
New Revision: 250993
URL: https://gcc.gnu.org/viewcvs?rev=250993&root=gcc&view=rev
Log:
PR libstdc++/81751 don't call fflush(NULL)
PR libstdc++/79820
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81751
--- Comment #6 from Jonathan Wakely ---
Or just call fflush(__file) directly:
https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00673.html
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81751
--- Comment #5 from Volker Wehrs ---
I'm sorry but I ignored the first if-clause in sys_open(). That if-clause makes
sure there is no open file referenced by the __basic_file, otherwise sys_open()
fails.
Then the sync() is called before the new
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81751
--- Comment #4 from Jonathan Wakely ---
But there is an open FILE and it might have pending writes or ungetc'd data
that should be flushed. I think that's why it's there. Consider:
FILE* f = std::fopen("81751.txt", "w+");
std::fwrite("Some w
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81751
--- Comment #3 from Volker Wehrs ---
Why is sync() (alias fflush()) called in sys_open(FILE*,...) at all?
1. It is not called in sys_open(int,...)
2. Both sys_open() functions are called in the constructor of stdio_filebuf
_only_.
So, as __basi
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81751
--- Comment #2 from Jonathan Wakely ---
The current __basic_file::sys_open behaviour came from the PR 17215 fix
(r86756). Before that change we called sync() after doing _M_cfile=__file, but
after we call sync() while it's still null.
I think ra
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81751
Jonathan Wakely changed:
What|Removed |Added
Status|UNCONFIRMED |NEW
Last reconfirmed|