summaryrefslogtreecommitdiff
path: root/src/wc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wc.c')
-rw-r--r--src/wc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wc.c b/src/wc.c
index 801396a15..becceda98 100644
--- a/src/wc.c
+++ b/src/wc.c
@@ -450,7 +450,10 @@ wc (int fd, char const *file_x, struct fstatus *fstatus, off_t current_pos)
beyond the end of the file. As in the example above. */
bytes = end_pos < current_pos ? 0 : end_pos - current_pos;
- skip_read = true;
+ if (bytes && 0 <= lseek (fd, bytes, SEEK_CUR))
+ skip_read = true;
+ else
+ bytes = 0;
}
else
{