Attempts to get file writes working properly again

This commit is contained in:
Alex Yatskov 2015-06-19 19:40:25 +09:00
parent aeb0822714
commit ec4e931f68
2 changed files with 5 additions and 4 deletions

2
dir.go
View File

@ -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
}

View File

@ -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
}