Commit b1aee138 authored by Yongwoo Park's avatar Yongwoo Park Committed by Han-Wen Nienhuys

fuse/nodefs: clear entryOut in ReadDirPlus

fuse.EntryOut can be corrupted if FS implementation does not set all fileds in the Lookup of rawFS
go-mtpfs displays wrong information(ls -l) for directory(size, Nlink, ..)
parent 148d3830
...@@ -83,11 +83,10 @@ func (d *connectorDir) ReadDirPlus(input *fuse.ReadIn, out *fuse.DirEntryList) ( ...@@ -83,11 +83,10 @@ func (d *connectorDir) ReadDirPlus(input *fuse.ReadIn, out *fuse.DirEntryList) (
continue continue
} }
code := d.rawFS.Lookup(&input.InHeader, e.Name, entryDest) // Clear entryDest before use it, some fields can be corrupted if does not set all fields in rawFS.Lookup
if !code.Ok() { *entryDest = fuse.EntryOut{}
// if something went wrong, clear out the entry.
*entryDest = fuse.EntryOut{} d.rawFS.Lookup(&input.InHeader, e.Name, entryDest)
}
d.lastOffset = off d.lastOffset = off
} }
return fuse.OK return fuse.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