mount: fix panic on File.Open - Fixes #3595

This problem was introduced in "mount: allow files of unkown size to
be read properly" 0baafb158f by failure to check that the
DirEntry was nil or not.
This commit is contained in:
Nick Craig-Wood 2019-10-06 12:06:26 +01:00
parent 6337cc70d3
commit 15b1feea9d

View File

@ -74,7 +74,7 @@ func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenR
}
// If size unknown then use direct io to read
if handle.Node().DirEntry().Size() < 0 {
if entry := handle.Node().DirEntry(); entry != nil && entry.Size() < 0 {
resp.Flags |= fuse.OpenDirectIO
}