]> git.ipfire.org Git - thirdparty/coreutils.git/commit
head,tail: consistently diagnose write errors
authorPádraig Brady <P@draigBrady.com>
Wed, 29 Jan 2014 04:42:56 +0000 (04:42 +0000)
committerPádraig Brady <P@draigBrady.com>
Sun, 9 Feb 2014 21:37:24 +0000 (21:37 +0000)
commit6e824a66194528696ba265d6111a6bddce4a8ff8
tree13ae36f27040f4db4b220ab753694e00f45aa7d9
parent476ce37019df5b1cb917c5b50e71f9bce5911401
head,tail: consistently diagnose write errors

If we can't output more data, we should immediately
diagnose the issue and exit rather than consuming all
of input (in some cases).

* src/tail.c (xwrite_stdout): Also diagnose the case where
only some data is written.  Also clearerr() to avoid the
redundant less specific error from atexit (close_stdout);
* src/head.c (xwrite_stdout): Copy this new function from tail,
and use it to write all output.
* tests/misc/head-write-error.sh: A new test to ensure we
exit immediately on write error.
* tests/local.mk: Reference the new test.
src/head.c
src/tail.c
tests/local.mk
tests/misc/head-write-error.sh [new file with mode: 0755]