]> git.ipfire.org Git - thirdparty/coreutils.git/commit
head: fix processing of non-seekable input as seekable
authorPádraig Brady <P@draigBrady.com>
Mon, 28 Nov 2016 17:11:18 +0000 (17:11 +0000)
committerPádraig Brady <P@draigBrady.com>
Mon, 28 Nov 2016 18:36:32 +0000 (18:36 +0000)
commit0655b86a6ebc6f1324810d504a71803aa708d162
tree457a99f6d50d5c5f8b4a0ce13b6394503914f260
parentd8104265f229ababd5a68a46eeccbccc07e72cdc
head: fix processing of non-seekable input as seekable

* src/head.c (elide_tail_bytes_file): Ensure we don't use
st_size unless we've previously used seek() to determine
the CURRENT_POS in the seekable file.
This was seen to cause issue on FreeBSD 11 when the pipe
buffer was filled with `yes | head --lines=-0`, in which
case st_size was 64KiB while ST_BLKSIZE() was 4KiB.
Reported by Assaf Gordon.
NEWS
src/head.c