From: Jim Meyering Date: Fri, 1 Feb 2002 09:12:50 +0000 (+0000) Subject: (start_lines): Handle the case in which bytes_read is zero. X-Git-Tag: TEXTUTILS-2_0_21~131 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=31cb36e88f2ab50493d3badd12c021746d2b4e2c;p=thirdparty%2Fcoreutils.git (start_lines): Handle the case in which bytes_read is zero. --- 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;