diff --git a/dir.go b/dir.go index 81e2198..246e593 100644 --- a/dir.go +++ b/dir.go @@ -95,7 +95,7 @@ func (vd *verDir) createFile(name string, flags fuse.OpenFlags) (*verFile, *verF node := newVerNode(childPath, vd.node.ver, nil, NodeFlagVer) file := newVerFile(node, vd) - handle, err := file.open(flags) + handle, err := file.open(flags, true) if err != nil { return nil, nil, err } diff --git a/file.go b/file.go index 165a055..d631e01 100644 --- a/file.go +++ b/file.go @@ -62,14 +62,15 @@ func (vf *verFile) version() error { return nil } -func (vf *verFile) open(flags fuse.OpenFlags) (*verFileHandle, error) { - if !flags.IsReadOnly() { +func (vf *verFile) open(flags fuse.OpenFlags, create bool) (*verFileHandle, error) { + if !create && !flags.IsReadOnly() { if err := vf.version(); err != nil { return nil, err } } path := vf.node.rebasedPath() + handle, err := os.OpenFile(path, int(flags), 0644) if err != nil { return nil, err @@ -105,7 +106,7 @@ func (vf *verFile) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp * // NodeOpener func (vf *verFile) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error) { - handle, err := vf.open(req.Flags) + handle, err := vf.open(req.Flags, false) if err != nil { return nil, err }