From d66819e17205a446430d34a9ba41625cec35be19 Mon Sep 17 00:00:00 2001 From: Chris Howey Date: Mon, 3 Jun 2013 20:50:34 -0500 Subject: [PATCH] Linux - ignore event changes --- fsnotify_linux.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fsnotify_linux.go b/fsnotify_linux.go index a71f0b3..d74b8e5 100644 --- a/fsnotify_linux.go +++ b/fsnotify_linux.go @@ -255,10 +255,12 @@ func (w *Watcher) readEvents() { if !event.ignoreLinux() { // Setup FSNotify flags (inherit from directory watch) w.fsnmut.Lock() - fsnFlags := w.fsnFlags[watchedName] - _, fsnFound := w.fsnFlags[event.Name] - if !fsnFound { - w.fsnFlags[event.Name] = fsnFlags + if _, fsnFound := w.fsnFlags[event.Name]; !fsnFound { + if fsnFlags, watchFound := w.fsnFlags[watchedName]; watchFound { + w.fsnFlags[event.Name] = fsnFlags + } else { + w.fsnFlags[event.Name] = FSN_ALL + } } w.fsnmut.Unlock() @@ -286,9 +288,8 @@ func (e *FileEvent) ignoreLinux() bool { // event was sent after the DELETE. This ignores that MODIFY and // assumes a DELETE will come or has come if the file doesn't exist. if !(e.IsDelete() || e.IsRename()) { - if _, statErr := os.Lstat(e.Name); os.IsNotExist(statErr) { - return true - } + _, statErr := os.Lstat(e.Name) + return os.IsNotExist(statErr) } return false } -- 2.50.1