summaryrefslogtreecommitdiff
path: root/libgo/go/os/file_plan9.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/os/file_plan9.go')
-rw-r--r--libgo/go/os/file_plan9.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/libgo/go/os/file_plan9.go b/libgo/go/os/file_plan9.go
index 9edb6bc0747..5276a7ec541 100644
--- a/libgo/go/os/file_plan9.go
+++ b/libgo/go/os/file_plan9.go
@@ -11,9 +11,9 @@ import (
"time"
)
-// File represents an open file descriptor.
-type File struct {
- *file
+// fixLongPath is a noop on non-Windows platforms.
+func fixLongPath(path string) string {
+ return path
}
// file is the real representation of *File.
@@ -135,21 +135,21 @@ func OpenFile(name string, flag int, perm FileMode) (*File, error) {
// Close closes the File, rendering it unusable for I/O.
// It returns an error, if any.
func (f *File) Close() error {
- if f == nil {
- return ErrInvalid
+ if err := f.checkValid("close"); err != nil {
+ return err
}
return f.file.close()
}
func (file *file) close() error {
- if file == nil || file.fd < 0 {
+ if file == nil || file.fd == badFd {
return ErrInvalid
}
var err error
if e := syscall.Close(file.fd); e != nil {
err = &PathError{"close", file.name, e}
}
- file.fd = -1 // so it can't be closed again
+ file.fd = badFd // so it can't be closed again
// no need for a finalizer anymore
runtime.SetFinalizer(file, nil)