diff --git a/external/gpl3/gcc/dist/libstdc++-v3/config/io/basic_file_stdio.cc b/external/gpl3/gcc/dist/libstdc++-v3/config/io/basic_file_stdio.cc index 09fdd750b807..5717924944bc 100644 --- a/external/gpl3/gcc/dist/libstdc++-v3/config/io/basic_file_stdio.cc +++ b/external/gpl3/gcc/dist/libstdc++-v3/config/io/basic_file_stdio.cc @@ -204,7 +204,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { this->close(); } __basic_file* - __basic_file::sys_open(__c_file* __file, ios_base::openmode) + __basic_file::sys_open(__c_file* __file, ios_base::openmode __mode) { __basic_file* __ret = NULL; if (!this->is_open() && __file) @@ -213,7 +213,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // POSIX guarantees that fflush sets errno on error, but C doesn't. errno = 0; do - __err = fflush(__file); + __err = (__mode == std::ios_base::in ? 0 : fflush(__file)); while (__err && errno == EINTR); errno = __save_errno; if (!__err) diff --git a/tests/lib/libstdc++/t_sync_with_stdio.sh b/tests/lib/libstdc++/t_sync_with_stdio.sh index 9c1dfaf7018d..fe76c49b988f 100644 --- a/tests/lib/libstdc++/t_sync_with_stdio.sh +++ b/tests/lib/libstdc++/t_sync_with_stdio.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_sync_with_stdio.sh,v 1.1 2024/04/28 01:21:27 riastradh Exp $ +# $NetBSD: t_sync_with_stdio.sh,v 1.2 2024/05/20 11:20:53 riastradh Exp $ # # Copyright (c) 2024 The NetBSD Foundation, Inc. # All rights reserved. @@ -32,7 +32,6 @@ cin_nosync_head() cin_nosync_body() { echo hello >in - atf_expect_fail "PR lib/58206: sync_with_stdio breaks reads from cin" atf_check -o inline:'6\n' "$(atf_get_srcdir)"/h_cin_nosync