From: Davidlohr Bueso <dave@xxxxxxx> Date: Fri, 22 Oct 2010 12:23:31 -0300 Subject: [PATCH 3/7] tailf: use xalloc for memory allocation Signed-off-by: Davidlohr Bueso <dave@xxxxxxx> --- text-utils/tailf.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/text-utils/tailf.c b/text-utils/tailf.c index dc18b2a..2dcdba3 100644 --- a/text-utils/tailf.c +++ b/text-utils/tailf.c @@ -29,7 +29,6 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <malloc.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> @@ -40,7 +39,9 @@ #ifdef HAVE_INOTIFY_INIT #include <sys/inotify.h> #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) { -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html