diff options
Diffstat (limited to 'inotify/inotify.go')
-rw-r--r-- | inotify/inotify.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/inotify/inotify.go b/inotify/inotify.go index d7e7044..7c80a00 100644 --- a/inotify/inotify.go +++ b/inotify/inotify.go @@ -1,4 +1,4 @@ -// Copyright 2015-2016 Luke Shumaker <lukeshu@sbcglobal.net>. +// Copyright 2015-2017 Luke Shumaker <lukeshu@sbcglobal.net>. // // This is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as @@ -157,16 +157,14 @@ func (in *Inotify) RmWatch(wd Wd) error { // Close closes the inotify instance; further calls to this object // will error. +// +// In the event of a double-close condition, in go <= 1.7, this +// returns an os.SyscallError wrapping unix.EBADF; on go >= 1.8, it +// returns os.ErrClosed. func (in *Inotify) Close() (err error) { defer func() { if r := recover(); r != nil { - // This is a double-close condition. - // - // Choices for the error: - // - Linux: EBADF - // - os.File: unix.EINVAL - // - net.netFD: net.errClosing = errors.New(...) - err = os.NewSyscallError("close", unix.EBADF) + err = errClosed } }() close(in.ch) // will panic if already closed; hence above |