diff options
author | Davidlohr Bueso | 2010-10-22 17:23:31 +0200 |
---|---|---|
committer | Karel Zak | 2010-11-01 14:31:34 +0100 |
commit | b7159bd5c901b7f785b0b3370b70a0ec5e4ffcf6 (patch) | |
tree | 2de4607ac4ff836e16a694b84dca943f293cad18 | |
parent | more: use xalloc for memory allocation (diff) | |
download | kernel-qcow2-util-linux-b7159bd5c901b7f785b0b3370b70a0ec5e4ffcf6.tar.gz kernel-qcow2-util-linux-b7159bd5c901b7f785b0b3370b70a0ec5e4ffcf6.tar.xz kernel-qcow2-util-linux-b7159bd5c901b7f785b0b3370b70a0ec5e4ffcf6.zip |
tailf: use xalloc for memory allocation
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
-rw-r--r-- | 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 dc18b2a64..2dcdba3f3 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) { |