summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-02-01 09:12:50 +0000
committerJim Meyering <jim@meyering.net>2002-02-01 09:12:50 +0000
commit31cb36e88f2ab50493d3badd12c021746d2b4e2c (patch)
treea004da3d85542358208ae892479c94c273bcd2ab
parent06506ceb4fe9045c7172b133e94dc158a4fa65d6 (diff)
downloadcoreutils-31cb36e88f2ab50493d3badd12c021746d2b4e2c.tar.xz
(start_lines): Handle the case in which bytes_read is zero.
-rw-r--r--src/tail.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tail.c b/src/tail.c
index 684cf1397..f94a075cf 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -756,6 +756,9 @@ start_lines (const char *pretty_filename, int fd, long int n_lines)
int bytes_read = 0;
int bytes_to_skip = 0;
+ if (n_lines == 0)
+ return 0;
+
while (n_lines && (bytes_read = safe_read (fd, buffer, BUFSIZ)) > 0)
{
bytes_to_skip = 0;