summaryrefslogtreecommitdiff
path: root/inotail.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2009-01-26 00:14:56 +0100
committerTobias Klauser <tklauser@distanz.ch>2009-01-26 00:14:56 +0100
commit56d64ae30089e7d5370057655ac198e7ada785e5 (patch)
tree14196950812dced59dbc8624ca56ed245cef350b /inotail.c
parent707761e5dcaccef569c2e36cf5fbac9a74817e9d (diff)
inotail.c: More graceful error handling in watch_file()
Extracted from the patch by Joe Pelkey
Diffstat (limited to 'inotail.c')
-rw-r--r--inotail.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/inotail.c b/inotail.c
index 55fa532..8ff7773 100644
--- a/inotail.c
+++ b/inotail.c
@@ -716,10 +716,15 @@ static int watch_files(struct file_struct *files, int n_files)
}
}
- if (unlikely(!f))
- break;
+ /* Spurious event */
+ if (unlikely(!f)) {
+ ev_idx += sizeof(struct inotify_event) + inev->len;
+ continue;
+ }
- if (handle_inotify_event(inev, f) < 0)
+ if (handle_inotify_event(inev, f) < 0 && n_ignored == n_files)
+ /* Got an error handling the event and no files
+ * left unignored */
break;
ev_idx += sizeof(struct inotify_event) + inev->len;