Commit 1fd5b968 by Ian Lance Taylor

os: Fix Solaris stat functions.

From Rainer Orth.

From-SVN: r184065
parent 16e0be9b
...@@ -9,18 +9,18 @@ import ( ...@@ -9,18 +9,18 @@ import (
"time" "time"
) )
func sameFile(fs1, fs2 *FileStat) bool { func sameFile(sys1, sys2 interface{}) bool {
sys1 := fs1.Sys.(*syscall.Stat_t) stat1 := sys1.(*syscall.Stat_t)
sys2 := fs2.Sys.(*syscall.Stat_t) stat2 := sys2.(*syscall.Stat_t)
return sys1.Dev == sys2.Dev && sys1.Ino == sys2.Ino return stat1.Dev == stat2.Dev && stat1.Ino == stat2.Ino
} }
func fileInfoFromStat(st *syscall.Stat_t, name string) FileInfo { func fileInfoFromStat(st *syscall.Stat_t, name string) FileInfo {
fs := &FileStat{ fs := &fileStat{
name: basename(name), name: basename(name),
size: int64(st.Size), size: int64(st.Size),
modTime: timestrucToTime(st.Mtime), modTime: timestrucToTime(st.Mtime),
Sys: st, sys: st,
} }
fs.mode = FileMode(st.Mode & 0777) fs.mode = FileMode(st.Mode & 0777)
switch st.Mode & syscall.S_IFMT { switch st.Mode & syscall.S_IFMT {
...@@ -52,5 +52,5 @@ func timestrucToTime(ts syscall.Timestruc) time.Time { ...@@ -52,5 +52,5 @@ func timestrucToTime(ts syscall.Timestruc) time.Time {
// For testing. // For testing.
func atime(fi FileInfo) time.Time { func atime(fi FileInfo) time.Time {
return timestrucToTime(fi.(*FileStat).Sys.(*syscall.Stat_t).Atime) return timestrucToTime(fi.(*fileStat).Sys().(*syscall.Stat_t).Atime)
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment