Skip to content

Commit

Permalink
Added ignoreLinux lstats back in
Browse files Browse the repository at this point in the history
  • Loading branch information
horahoradev committed Jul 23, 2022
1 parent 25921a5 commit 34f2c19
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion inotify.go
Expand Up @@ -297,7 +297,21 @@ func (w *Watcher) readEvents() {
// channel. Such as events marked ignore by the kernel, or MODIFY events
// against files that do not exist.
func (e *Event) ignoreLinux(mask uint32) bool {
return mask&unix.IN_IGNORED == unix.IN_IGNORED
// Ignore anything the inotify API says to ignore
if mask&unix.IN_IGNORED == unix.IN_IGNORED {
return true
}

// If the event is Create or Write, the file must exist, or the
// event will be suppressed.
// *Note*: this was put in place because it was seen that a Write
// event was sent after the Remove. This ignores the Write and
// assumes a Remove will come or has come if the file doesn't exist.
if e.Op&Create == Create || e.Op&Write == Write {
_, statErr := os.Lstat(e.Name)
return os.IsNotExist(statErr)
}
return false
}

// newEvent returns an platform-independent Event based on an inotify mask.
Expand Down

0 comments on commit 34f2c19

Please sign in to comment.