summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--src/head.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index e88e93214..ea84a4dba 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,10 @@ GNU coreutils NEWS -*- outline -*-
factor again outputs immediately when numbers are input interactively.
[bug introduced in coreutils-8.24]
+ head no longer tries to process non-seekable input as seekable,
+ which resulted in failures on FreeBSD 11 at least.
+ [bug introduced in coreutils-8.24]
+
install -DZ and mkdir -pZ now set default SELinux context correctly even if
two or more directories nested in each other are created and each of them
defaults to a different SELinux context.
diff --git a/src/head.c b/src/head.c
index 21ace70b4..756c978c6 100644
--- a/src/head.c
+++ b/src/head.c
@@ -465,7 +465,7 @@ elide_tail_bytes_file (const char *filename, int fd, uintmax_t n_elide,
struct stat const *st, off_t current_pos)
{
off_t size = st->st_size;
- if (presume_input_pipe || size <= ST_BLKSIZE (*st))
+ if (presume_input_pipe || current_pos < 0 || size <= ST_BLKSIZE (*st))
return elide_tail_bytes_pipe (filename, fd, n_elide, current_pos);
else
{
@@ -754,7 +754,7 @@ elide_tail_lines_file (const char *filename, int fd, uintmax_t n_elide,
struct stat const *st, off_t current_pos)
{
off_t size = st->st_size;
- if (presume_input_pipe || size <= ST_BLKSIZE (*st))
+ if (presume_input_pipe || current_pos < 0 || size <= ST_BLKSIZE (*st))
return elide_tail_lines_pipe (filename, fd, n_elide, current_pos);
else
{