]> go.fuhry.dev Git - fsnotify.git/commitdiff
inotify: Retry read on EINTR
authorPieter Droogendijk <pieter@binky.org.uk>
Thu, 5 Feb 2015 21:19:17 +0000 (22:19 +0100)
committerNathan Youngman <git@nathany.com>
Fri, 6 Feb 2015 00:18:13 +0000 (17:18 -0700)
closes #62

CHANGELOG.md
inotify.go

index 55a4e7b66ed50e6eb4c82062b681b18453342f9b..fe4c3ba46046cbb16640993cfc86d395f154f595 100644 (file)
@@ -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)
index f5c0aaef04787d312ddb6cb21c8e02722f1ffc43..1a693f3e38b8ad618400f133ec8ae40a8d4ef237 100644 (file)
@@ -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 {