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

Deal with FileInfo entries that have no Sys set.

This may happen with broken FUSE mounts.
parent 00947164
...@@ -153,14 +153,22 @@ func (a *Attr) ModTime() time.Time { ...@@ -153,14 +153,22 @@ func (a *Attr) ModTime() time.Time {
} }
func ToStatT(f os.FileInfo) *syscall.Stat_t { func ToStatT(f os.FileInfo) *syscall.Stat_t {
return f.(*os.FileStat).Sys.(*syscall.Stat_t) s := f.(*os.FileStat).Sys
if s != nil {
return s.(*syscall.Stat_t)
}
return nil
} }
func ToAttr(f os.FileInfo) *Attr { func ToAttr(f os.FileInfo) *Attr {
if f == nil { if f == nil {
return nil return nil
} }
a := &Attr{} s := ToStatT(f)
a.FromStat(ToStatT(f)) if s != nil {
return a a := &Attr{}
a.FromStat(s)
return a
}
return nil
} }
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