summaryrefslogtreecommitdiff
path: root/src/pkg/os/stat_plan9.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/os/stat_plan9.go')
-rw-r--r--src/pkg/os/stat_plan9.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/pkg/os/stat_plan9.go b/src/pkg/os/stat_plan9.go
index e96749d33..d2300d598 100644
--- a/src/pkg/os/stat_plan9.go
+++ b/src/pkg/os/stat_plan9.go
@@ -26,7 +26,7 @@ func fileInfoFromStat(fi *FileInfo, d *Dir) *FileInfo {
}
// arg is an open *File or a path string.
-func dirstat(arg interface{}) (fi *FileInfo, err Error) {
+func dirstat(arg interface{}) (d *Dir, err Error) {
var name string
nd := syscall.STATFIXLEN + 16*4
@@ -62,8 +62,7 @@ func dirstat(arg interface{}) (fi *FileInfo, err Error) {
if e != nil {
return nil, &PathError{"stat", name, e}
}
-
- return fileInfoFromStat(new(FileInfo), d), nil
+ return d, e
}
}
@@ -73,12 +72,20 @@ func dirstat(arg interface{}) (fi *FileInfo, err Error) {
// Stat returns a FileInfo structure describing the named file and an error, if any.
func Stat(name string) (fi *FileInfo, err Error) {
- return dirstat(name)
+ d, err := dirstat(name)
+ if iserror(err) {
+ return nil, err
+ }
+ return fileInfoFromStat(new(FileInfo), d), err
}
// Lstat returns the FileInfo structure describing the named file and an
// error, if any. If the file is a symbolic link (though Plan 9 does not have symbolic links),
// the returned FileInfo describes the symbolic link. Lstat makes no attempt to follow the link.
func Lstat(name string) (fi *FileInfo, err Error) {
- return dirstat(name)
+ d, err := dirstat(name)
+ if iserror(err) {
+ return nil, err
+ }
+ return fileInfoFromStat(new(FileInfo), d), err
}