mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-20 02:36:16 +02:00
all: avoid duplicated write errors on FreeBSD
* src/system.h (write_error): Also call fpurge(), which was seen to be needed on FreeBSD 13.1 to avoid duplicated write errors. * src/head.c (xwrite_stdout): Likewise. * bootstrap.conf: Depend on fpurge. Reported by Bruno Haible.
This commit is contained in:
@@ -104,6 +104,7 @@ gnulib_modules="
|
||||
fnmatch-gnu
|
||||
fopen-safer
|
||||
fprintftime
|
||||
fpurge
|
||||
free-posix
|
||||
freopen
|
||||
freopen-safer
|
||||
|
||||
@@ -181,6 +181,7 @@ xwrite_stdout (char const *buffer, size_t n_bytes)
|
||||
if (n_bytes > 0 && fwrite (buffer, 1, n_bytes, stdout) < n_bytes)
|
||||
{
|
||||
clearerr (stdout); /* To avoid redundant close_stdout diagnostic. */
|
||||
fpurge (stdout);
|
||||
error (EXIT_FAILURE, errno, _("error writing %s"),
|
||||
quoteaf ("standard output"));
|
||||
}
|
||||
|
||||
@@ -769,8 +769,9 @@ static inline void
|
||||
write_error (void)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
fflush (stdout); /* Ensure nothing buffered that might induce an error. */
|
||||
clearerr (stdout); /* To avoid extraneous diagnostic from close_stdout. */
|
||||
fflush (stdout); /* Last attempt to write any buffered data. */
|
||||
fpurge (stdout); /* Ensure nothing buffered that might induce an error. */
|
||||
clearerr (stdout); /* Avoid extraneous diagnostic from close_stdout. */
|
||||
error (EXIT_FAILURE, saved_errno, _("write error"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user