inotify.go: Fix bug where inotify returns IN_ATTRIB against an open fd

This commit is contained in:
TerraTech 2016-09-08 17:51:15 -07:00 committed by coreos
parent a30252cb68
commit bf39eb4f51
1 changed files with 9 additions and 0 deletions

View File

@ -95,6 +95,15 @@ func (fw *InotifyFileWatcher) ChangeEvents(t *tomb.Tomb, pos int64) (*FileChange
} }
switch { 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: case evt.Op&fsnotify.Remove == fsnotify.Remove:
fallthrough fallthrough