Commit 703cbead authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Fix failure case handling in PathFilesystem.{Unlink,Rmdir}.

parent 8effbf7f
...@@ -586,11 +586,10 @@ func (me *PathFileSystemConnector) Mkdir(header *InHeader, input *MkdirIn, name ...@@ -586,11 +586,10 @@ func (me *PathFileSystemConnector) Mkdir(header *InHeader, input *MkdirIn, name
if mount == nil { if mount == nil {
return nil, ENOENT return nil, ENOENT
} }
err := mount.fs.Mkdir(filepath.Join(fullPath, name), input.Mode) code = mount.fs.Mkdir(filepath.Join(fullPath, name), input.Mode)
if err != OK { if code == OK {
return nil, err out, code = me.Lookup(header, name)
} }
out, code = me.Lookup(header, name)
return out, code return out, code
} }
...@@ -600,10 +599,10 @@ func (me *PathFileSystemConnector) Unlink(header *InHeader, name string) (code S ...@@ -600,10 +599,10 @@ func (me *PathFileSystemConnector) Unlink(header *InHeader, name string) (code S
return ENOENT return ENOENT
} }
code = mount.fs.Unlink(filepath.Join(fullPath, name)) code = mount.fs.Unlink(filepath.Join(fullPath, name))
if code == OK {
// Like fuse.c, we update our internal tables. // Like fuse.c, we update our internal tables.
me.unlinkUpdate(header.NodeId, name) me.unlinkUpdate(header.NodeId, name)
}
return code return code
} }
...@@ -613,7 +612,9 @@ func (me *PathFileSystemConnector) Rmdir(header *InHeader, name string) (code St ...@@ -613,7 +612,9 @@ func (me *PathFileSystemConnector) Rmdir(header *InHeader, name string) (code St
return ENOENT return ENOENT
} }
code = mount.fs.Rmdir(filepath.Join(fullPath, name)) code = mount.fs.Rmdir(filepath.Join(fullPath, name))
me.unlinkUpdate(header.NodeId, name) if code == OK {
me.unlinkUpdate(header.NodeId, name)
}
return code return code
} }
......
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