Commit 7a509a55 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Fix possible nil pointer dereference in PathNodeFs.GetAttr().

parent 1de52cb6
...@@ -532,7 +532,6 @@ func (n *pathInode) GetAttr(out *Attr, file File, context *Context) (code Status ...@@ -532,7 +532,6 @@ func (n *pathInode) GetAttr(out *Attr, file File, context *Context) (code Status
if file == nil || code == ENOSYS || code == EBADF { if file == nil || code == ENOSYS || code == EBADF {
fi, code = n.fs.GetAttr(n.GetPath(), context) fi, code = n.fs.GetAttr(n.GetPath(), context)
*out = *fi
} }
if fi != nil { if fi != nil {
...@@ -542,6 +541,10 @@ func (n *pathInode) GetAttr(out *Attr, file File, context *Context) (code Status ...@@ -542,6 +541,10 @@ func (n *pathInode) GetAttr(out *Attr, file File, context *Context) (code Status
if fi != nil && !fi.IsDir() && fi.Nlink == 0 { if fi != nil && !fi.IsDir() && fi.Nlink == 0 {
fi.Nlink = 1 fi.Nlink = 1
} }
if fi != nil {
*out = *fi
}
return code return code
} }
......
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