summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2011-02-07 12:02:53 +0100
committerTobias Klauser <tklauser@distanz.ch>2011-02-07 12:02:53 +0100
commita449425fc86e6ef5ef2a1efb37b0cc645f1b0680 (patch)
tree7e9d828f2dd9250bc94ed441fa679c5fdba38900
parent9943e243f169f30c4397626df5d124f8a7c12546 (diff)
Dynamically allocate inotify read bufferHEADmaster
This fixes a sparse warning.
-rw-r--r--inotail.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/inotail.c b/inotail.c
index fe36a45..35fdd82 100644
--- a/inotail.c
+++ b/inotail.c
@@ -707,7 +707,7 @@ ignore:
static int watch_files(struct file_struct *files, int n_files)
{
int ifd, i;
- char buf[n_files * INOTIFY_BUFLEN];
+ char *buf = emalloc(n_files * INOTIFY_BUFLEN);
ifd = inotify_init();
if (errno == ENOSYS) {
@@ -775,6 +775,7 @@ static int watch_files(struct file_struct *files, int n_files)
}
}
+ free(buf);
close(ifd);
return -1;