diff options
Diffstat (limited to 'libgo/go/os/stat_plan9.go')
-rw-r--r-- | libgo/go/os/stat_plan9.go | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libgo/go/os/stat_plan9.go b/libgo/go/os/stat_plan9.go index e96749d..173a23f 100644 --- a/libgo/go/os/stat_plan9.go +++ b/libgo/go/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,23 +62,29 @@ 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 } } return nil, &PathError{"stat", name, Ebadstat} } - // 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 } |