From 4de334e034a014cf4c5c2cfe4c6578397fd6153a Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Fri, 24 Jul 2015 15:20:43 +1000 Subject: [PATCH] Fixed a bug related to EINTR. --- connection.go | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/connection.go b/connection.go index b9c027d..2d5d9ee 100644 --- a/connection.go +++ b/connection.go @@ -232,15 +232,27 @@ func (c *Connection) readMessage() (m *buffer.InMessage, err error) { err = m.Init(c.wrapped.Dev) c.wrapped.Rio.RUnlock() + // Special cases: + // + // * ENODEV means fuse has hung up. + // + // * EINTR means we should try again. (This seems to happen often on + // OS X, cf. http://golang.org/issue/11180) + // + if pe, ok := err.(*os.PathError); ok { + switch pe.Err { + case syscall.ENODEV: + err = io.EOF + + case syscall.EINTR: + err = nil + continue + } + } + if err != nil { c.destroyInMessage(m) m = nil - - // Special case: ENODEV means fuse has hung up. - if pe, ok := err.(*os.PathError); ok && pe.Err == syscall.ENODEV { - err = io.EOF - } - return }