aboutsummaryrefslogtreecommitdiff
path: root/miscutils/inotifyd.c
diff options
context:
space:
mode:
Diffstat (limited to 'miscutils/inotifyd.c')
-rw-r--r--miscutils/inotifyd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/miscutils/inotifyd.c b/miscutils/inotifyd.c
index 908d657fd..52db08ada 100644
--- a/miscutils/inotifyd.c
+++ b/miscutils/inotifyd.c
@@ -56,6 +56,7 @@
56//usage: "\nWhen x event happens for all FILEs, inotifyd exits." 56//usage: "\nWhen x event happens for all FILEs, inotifyd exits."
57 57
58#include "libbb.h" 58#include "libbb.h"
59#include "common_bufsiz.h"
59#include <sys/inotify.h> 60#include <sys/inotify.h>
60 61
61static const char mask_names[] ALIGN1 = 62static const char mask_names[] ALIGN1 =
@@ -161,9 +162,10 @@ int inotifyd_main(int argc, char **argv)
161 162
162 // read out all pending events 163 // read out all pending events
163 // (NB: len must be int, not ssize_t or long!) 164 // (NB: len must be int, not ssize_t or long!)
164 xioctl(pfd.fd, FIONREAD, &len);
165#define eventbuf bb_common_bufsiz1 165#define eventbuf bb_common_bufsiz1
166 ie = buf = (len <= sizeof(eventbuf)) ? eventbuf : xmalloc(len); 166 setup_common_bufsiz();
167 xioctl(pfd.fd, FIONREAD, &len);
168 ie = buf = (len <= COMMON_BUFSIZE) ? eventbuf : xmalloc(len);
167 len = full_read(pfd.fd, buf, len); 169 len = full_read(pfd.fd, buf, len);
168 // process events. N.B. events may vary in length 170 // process events. N.B. events may vary in length
169 while (len > 0) { 171 while (len > 0) {