Skip to content

Commit

Permalink
inotify: Retry read on EINTR
Browse files Browse the repository at this point in the history
closes howeyc#62
  • Loading branch information
PieterD authored and nathany committed Feb 6, 2015
1 parent 76b5bcc commit 7ea9131
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.1.1 / 2015-02-05

* inotify: Retry read on EINTR [#61](https://github.com/go-fsnotify/fsnotify/issues/61) (thanks @PieterD)

## v1.1.0 / 2014-12-12

* kqueue: rework internals [#43](https://github.com/go-fsnotify/fsnotify/pull/43)
Expand Down
6 changes: 6 additions & 0 deletions inotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ func (w *Watcher) readEvents() {
}

n, errno = syscall.Read(w.fd, buf[:])
// If a signal interrupted execution, see if we've been asked to close, and try again.
// http://man7.org/linux/man-pages/man7/signal.7.html :
// "Before Linux 3.8, reads from an inotify(7) file descriptor were not restartable"
if errno == syscall.EINTR {
continue
}

// If EOF is received
if n == 0 {
Expand Down

0 comments on commit 7ea9131

Please sign in to comment.