Commit 00947164 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Use syscall directly rather than os functions.

parent 3ab227cc
......@@ -131,12 +131,13 @@ func (me *LoopbackFile) Chown(uid uint32, gid uint32) Status {
}
func (me *LoopbackFile) GetAttr() (*Attr, Status) {
fi, err := me.File.Stat()
st := syscall.Stat_t{}
err := syscall.Fstat(me.File.Fd(), &st)
if err != nil {
return nil, ToStatus(err)
}
a := &Attr{}
a.FromFileInfo(fi)
a.FromStat(&st)
return a, OK
}
......
......@@ -37,19 +37,19 @@ func (me *LoopbackFileSystem) GetPath(relPath string) string {
func (me *LoopbackFileSystem) GetAttr(name string, context *Context) (a *Attr, code Status) {
fullPath := me.GetPath(name)
var err error = nil
var fi os.FileInfo
st := syscall.Stat_t{}
if name == "" {
// When GetAttr is called for the toplevel directory, we always want
// to look through symlinks.
fi, err = os.Stat(fullPath)
err = syscall.Stat(fullPath, &st)
} else {
fi, err = os.Lstat(fullPath)
err = syscall.Lstat(fullPath, &st)
}
if err != nil {
return nil, ToStatus(err)
}
a = &Attr{}
a.FromFileInfo(fi)
a.FromStat(&st)
return a, OK
}
......
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