fuse: support R/W files only if truncate is set.

Any reads on the file handle will return an error.  This is to support
windows/samba writes.
This commit is contained in:
Nick Craig-Wood 2016-11-28 17:56:54 +00:00
parent 2756900749
commit 7929b6e756

View File

@ -119,7 +119,7 @@ func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenR
resp.Flags |= fuse.OpenNonSeekable
}
return newReadFileHandle(o)
case req.Flags.IsWriteOnly():
case req.Flags.IsWriteOnly() || (req.Flags.IsReadWrite() && (req.Flags&fuse.OpenTruncate) != 0):
resp.Flags |= fuse.OpenNonSeekable
src := newCreateInfo(f.d.f, o.Remote())
fh, err := newWriteFileHandle(f.d, f, src)