Skip to content

Commit

Permalink
inotify.go: Fix bug where inotify returns IN_ATTRIB against an open fd
Browse files Browse the repository at this point in the history
  • Loading branch information
TerraTech committed Sep 9, 2016
1 parent a30252c commit bf39eb4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions watch/inotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit bf39eb4

Please sign in to comment.