mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
os: add ErrClosed, return for use of closed File
This is clearer than syscall.EBADF. Fixes #17320. Change-Id: I14c6a362f9a6044c9b07cd7965499f4a83d2a860 Reviewed-on: https://go-review.googlesource.com/30614 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
452bbfc179
commit
212d2f82e0
10 changed files with 70 additions and 30 deletions
|
|
@ -128,7 +128,7 @@ func (f *File) Close() error {
|
|||
}
|
||||
|
||||
func (file *file) close() error {
|
||||
if file == nil || file.fd < 0 {
|
||||
if file == nil || file.fd == badFd {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
var err error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue