Merge pull request #101 from TerraTech/master
inotify.go: Fix bug where inotify returns IN_ATTRIB against an open fd when deleted
This commit is contained in:
commit
915e5feba0
|
@ -95,6 +95,15 @@ func (fw *InotifyFileWatcher) ChangeEvents(t *tomb.Tomb, pos int64) (*FileChange
|
|||
}
|
||||
|
||||
switch {
|
||||
//With an open fd, unlink(fd) - inotify returns IN_ATTRIB (==fsnotify.Chmod)
|
||||
case evt.Op&fsnotify.Chmod == fsnotify.Chmod:
|
||||
if _, err := os.Stat(fw.Filename); err != nil {
|
||||
if ! os.IsNotExist(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
fallthrough
|
||||
|
||||
case evt.Op&fsnotify.Remove == fsnotify.Remove:
|
||||
fallthrough
|
||||
|
||||
|
|
Loading…
Reference in New Issue