tailf: support --lines 0

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2011-03-18 09:52:07 +01:00
parent 5af1532e05
commit 127b12dcf6
1 changed files with 1 additions and 1 deletions

View File

@ -60,7 +60,7 @@ tailf(const char *filename, int lines)
if (!(str = fopen(filename, "r")))
err(EXIT_FAILURE, _("cannot open \"%s\" for read"), filename);
buf = xmalloc(lines * BUFSIZ);
buf = xmalloc((lines ? lines : 1) * BUFSIZ);
p = buf;
while (fgets(p, BUFSIZ, str)) {
if (++tail >= lines) {