From 31cb36e88f2ab50493d3badd12c021746d2b4e2c Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 1 Feb 2002 09:12:50 +0000 Subject: [PATCH] (start_lines): Handle the case in which bytes_read is zero. --- src/tail.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tail.c b/src/tail.c index 684cf1397e..f94a075cfe 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; -- 2.47.3