]> git.ipfire.org Git - thirdparty/coreutils.git/commit
all: avoid repeated diagnostic upon write error
authorPádraig Brady <P@draigBrady.com>
Sat, 15 Jul 2023 19:41:44 +0000 (20:41 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 17 Jul 2023 10:28:36 +0000 (11:28 +0100)
commit0b2ff7637f1eabba48e461f9f6e3aec956bed7d1
tree88b8cf5af2b11d9e2bc10c0f3fac2911e4709bae
parentef47b928d0b4fb96c8d458450c941fe1eb487542
all: avoid repeated diagnostic upon write error

* cfg.mk (sc_some_programs_must_avoid_exit_failure): Adjust to
avoid false positive.
(sc_prohibit_exit_write_error): A new syntax check to prohibit
open coding error(..., "write error"); instead directing to use...
* src/system.h (write_error): ... a new function to clear stdout errors
before we explicitly diagnose a write error and exit.
* src/basenc.c: Use write_error() to ensure no repeated diagnostics.
* src/cat.c: Likewise.
* src/expand.c: Likewise.
* src/factor.c: Likewise.
* src/paste.c: Likewise.
* src/seq.c: Likewise.
* src/shuf.c: Likewise.
* src/split.c: Likewise.
* src/tail.c: Likewise.
* src/tr.c: Likewise.
* src/unexpand.c: Likewise.
* tests/misc/write-errors.sh: Remove TODOs for the fixed utilities:
expand, factor, paste, shuf, tr, unexpand.
14 files changed:
cfg.mk
src/basenc.c
src/cat.c
src/expand.c
src/factor.c
src/paste.c
src/seq.c
src/shuf.c
src/split.c
src/system.h
src/tail.c
src/tr.c
src/unexpand.c
tests/misc/write-errors.sh