summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inotail.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/inotail.c b/inotail.c
index da793db..c0c5302 100644
--- a/inotail.c
+++ b/inotail.c
@@ -235,7 +235,7 @@ static int watch_files(struct file_struct *f, int n_files)
inev = (struct inotify_event *) &buf;
while (len > 0) {
- struct file_struct *fil;
+ struct file_struct *fil = NULL;
/* Which file has produced the event? */
for (i = 0; i < n_files; i++) {
@@ -245,7 +245,10 @@ static int watch_files(struct file_struct *f, int n_files)
}
}
- /* XXX: Is it possible that no file in the list produced the event? */
+ /* Very unlikely! */
+ if (!fil)
+ break;
+
if (inev->mask & IN_MODIFY) {
int rc;
char fbuf[BUFFER_SIZE];