]> Cypherpunks repositories - gostls13.git/commitdiff
os: return ErrInvalid if receiver is nil.
authorDave Cheney <dave@cheney.net>
Fri, 3 Jan 2014 21:25:09 +0000 (08:25 +1100)
committerDave Cheney <dave@cheney.net>
Fri, 3 Jan 2014 21:25:09 +0000 (08:25 +1100)
Fixes #7043.

Test coming in https://golang.org/cl/46820043

R=r, bradfitz
CC=golang-codereviews
https://golang.org/cl/38330045

src/pkg/os/file_posix.go

index 90838682b683ef23f8c9f366568ba7052e603224..4a17877547dff0b158aad86e6bc644ed827a3057 100644 (file)
@@ -144,7 +144,7 @@ func (f *File) Truncate(size int64) error {
 // of recently written data to disk.
 func (f *File) Sync() (err error) {
        if f == nil {
-               return syscall.EINVAL
+               return ErrInvalid
        }
        if e := syscall.Fsync(f.fd); e != nil {
                return NewSyscallError("fsync", e)