1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-20 18:56:39 +02:00

du: promptly diagnose write errors

* src/du.c (print_size): Call write_error() if can't flush.
* tests/misc/write-errors.sh: Add a test case.
* NEWS: Mention the improvement.
This commit is contained in:
Pádraig Brady
2026-01-09 14:20:56 +00:00
parent 83f274feaa
commit 19d2d707f7
3 changed files with 7 additions and 4 deletions

View File

@@ -406,7 +406,9 @@ print_size (const struct duinfo *pdui, char const *string)
}
}
printf ("\t%s%c", string, opt_nul_terminate_output ? '\0' : '\n');
fflush (stdout);
if (fflush (stdout) != 0)
write_error ();
}
/* Fill the di_mnt set with local mount point dev/ino pairs. */