From: Davidlohr Bueso Date: Fri, 22 Oct 2010 15:23:31 +0000 (-0300) Subject: tailf: use xalloc for memory allocation X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7159bd5c901b7f785b0b3370b70a0ec5e4ffcf6;p=util-linux tailf: use xalloc for memory allocation Signed-off-by: Davidlohr Bueso --- diff --git a/text-utils/tailf.c b/text-utils/tailf.c index dc18b2a6..2dcdba3f 100644 --- a/text-utils/tailf.c +++ b/text-utils/tailf.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -40,7 +39,9 @@ #ifdef HAVE_INOTIFY_INIT #include #endif + #include "nls.h" +#include "xalloc.h" #include "usleep.h" #define DEFAULT_LINES 10 @@ -57,7 +58,7 @@ tailf(const char *filename, int lines) if (!(str = fopen(filename, "r"))) err(EXIT_FAILURE, _("cannot open \"%s\" for read"), filename); - buf = malloc(lines * BUFSIZ); + buf = xmalloc(lines * BUFSIZ); p = buf; while (fgets(p, BUFSIZ, str)) { if (++tail >= lines) {