tailf: support --lines 0
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
5af1532e05
commit
127b12dcf6
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue