libstdc++: Don't try to fflush stdin in gcc.old libstdc++ either.

PR lib/58206
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114879
This commit is contained in:
riastradh 2024-05-20 19:36:30 +00:00
parent 44dc91bb82
commit 721b426c77
1 changed files with 2 additions and 2 deletions

View File

@ -190,7 +190,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ this->close(); } { this->close(); }
__basic_file<char>* __basic_file<char>*
__basic_file<char>::sys_open(__c_file* __file, ios_base::openmode) __basic_file<char>::sys_open(__c_file* __file, ios_base::openmode __mode)
{ {
__basic_file* __ret = NULL; __basic_file* __ret = NULL;
if (!this->is_open() && __file) if (!this->is_open() && __file)
@ -199,7 +199,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// POSIX guarantees that fflush sets errno on error, but C doesn't. // POSIX guarantees that fflush sets errno on error, but C doesn't.
errno = 0; errno = 0;
do do
__err = fflush(__file); __err = (__mode == std::ios_base::in ? 0 : fflush(__file));
while (__err && errno == EINTR); while (__err && errno == EINTR);
errno = __save_errno; errno = __save_errno;
if (!__err) if (!__err)