summaryrefslogtreecommitdiff
path: root/src/tail.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-04-17 11:50:03 +0000
committerJim Meyering <jim@meyering.net>1999-04-17 11:50:03 +0000
commitdd886e96909595250b088fcdbed13010776b7853 (patch)
treeb09f2db9536a9f37ad3d725b82680e888a2645b0 /src/tail.c
parent6a821331eba6ac8ce7a501338e89fcac2f6547df (diff)
downloadcoreutils-dd886e96909595250b088fcdbed13010776b7853.tar.xz
(file_lines): Fix serious bug introduced with last changes.
From Andreas Schwab.
Diffstat (limited to 'src/tail.c')
-rw-r--r--src/tail.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tail.c b/src/tail.c
index 6a6bbcee9..ef125728d 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -346,6 +346,8 @@ file_lines (const char *pretty_filename, int fd, long int n_lines,
print the text after it. */
if (i != bytes_read - 1)
xwrite (STDOUT_FILENO, &buffer[i + 1], bytes_read - (i + 1));
+ dump_remainder (pretty_filename, fd,
+ file_length - (pos + bytes_read));
return 0;
}
}
@@ -363,11 +365,13 @@ file_lines (const char *pretty_filename, int fd, long int n_lines,
lseek (fd, pos, SEEK_SET);
}
while ((bytes_read = safe_read (fd, buffer, BUFSIZ)) > 0);
+
if (bytes_read == -1)
{
error (0, errno, "%s", pretty_filename);
return 1;
}
+
return 0;
}