diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2006-09-26 13:41:49 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@xenon.tklauser.home> | 2006-09-26 13:41:49 +0200 |
commit | 52ab266b8930d2b82554c8df87f8146a07e5f33b (patch) | |
tree | 40ed73aa2afd4789dadd204fce335599727d7b21 /inotail.c | |
parent | eba423cf8be7d22dc3fb958a49fed9cd9211047d (diff) |
Add check for the case that no file produced the inotify event
This could use an unlikely()
Diffstat (limited to 'inotail.c')
-rw-r--r-- | inotail.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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]; |