From: Chris Howey Date: Tue, 4 Jun 2013 01:50:34 +0000 (-0500) Subject: Linux - ignore event changes X-Git-Tag: v1.7.2~350 X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=d66819e17205a446430d34a9ba41625cec35be19;p=fsnotify.git Linux - ignore event changes --- 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 }