summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2006-09-26 13:41:49 +0200
committerTobias Klauser <tklauser@xenon.tklauser.home>2006-09-26 13:41:49 +0200
commit52ab266b8930d2b82554c8df87f8146a07e5f33b (patch)
tree40ed73aa2afd4789dadd204fce335599727d7b21
parenteba423cf8be7d22dc3fb958a49fed9cd9211047d (diff)
Add check for the case that no file produced the inotify event
This could use an unlikely()
-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];