From: Karel Zak Date: Fri, 18 Mar 2011 08:52:07 +0000 (+0100) Subject: tailf: support --lines 0 X-Git-Tag: v2.20-rc1~431 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=127b12dcf6bd1a150fa2ebdec3161fcddab9ada6;p=thirdparty%2Futil-linux.git tailf: support --lines 0 Signed-off-by: Karel Zak --- diff --git a/text-utils/tailf.c b/text-utils/tailf.c index 0b99a1ae69..fbe81c89de 100644 --- a/text-utils/tailf.c +++ b/text-utils/tailf.c @@ -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) {