summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-03-31 10:21:58 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2014-03-31 10:24:07 -0700
commitd08381bc261d95502a205f7214686f80383c9692 (patch)
tree7cb9c052f70fe75fe4474233a6ca500afacc871b /src
parent2d8ae88a228ac82c725f22aaee24accde8a12dcf (diff)
downloadcoreutils-d08381bc261d95502a205f7214686f80383c9692.tar.xz
head: fix bug with head -c-N when stdin is not at start
* src/head.c (elide_tail_bytes_file): Fix typo in lseek invocation. * tests/misc/head-c.sh: Add test for this bug. * NEWS: Document this.
Diffstat (limited to 'src')
-rw-r--r--src/head.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/head.c b/src/head.c
index b833af675..e27ce4618 100644
--- a/src/head.c
+++ b/src/head.c
@@ -443,7 +443,7 @@ elide_tail_bytes_file (const char *filename, int fd, uintmax_t n_elide)
/* Seek back to 'current' position, then copy the required
number of bytes from fd. */
- if (lseek (fd, 0, current_pos) == -1)
+ if (lseek (fd, current_pos, SEEK_SET) < 0)
{
error (0, errno, _("%s: cannot lseek back to original position"),
quote (filename));