From 56d64ae30089e7d5370057655ac198e7ada785e5 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 26 Jan 2009 00:14:56 +0100 Subject: inotail.c: More graceful error handling in watch_file() Extracted from the patch by Joe Pelkey --- inotail.c | 11 ++++++++--- 1 file 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; -- cgit v1.2.3-54-g00ecf