Merge "fs: make a copy of the value buffer when setting an xattr"

This commit is contained in:
Brad Fitzpatrick 2014-12-24 00:36:43 +00:00 committed by Gerrit Code Review
commit 0cfaf301d7
2 changed files with 4 additions and 2 deletions

View File

@ -432,7 +432,7 @@ func (n *mutDir) Remove(req *fuse.RemoveRequest, intr fs.Intr) fuse.Error {
claim := schema.NewDelAttributeClaim(n.permanode, "camliPath:"+req.Name, "")
_, err := n.fs.client.UploadAndSignBlob(claim)
if err != nil {
log.Println("mutDir.Create:", err)
log.Println("mutDir.Remove:", err)
return fuse.EIO
}
// Remove child from map.

View File

@ -84,8 +84,10 @@ func (x *xattr) set(req *fuse.SetxattrRequest) fuse.Error {
return fuse.EIO
}
val := make([]byte, len(req.Xattr))
copy(val, req.Xattr)
x.mu.Lock()
(*x.xattrs)[req.Name] = req.Xattr
(*x.xattrs)[req.Name] = val
x.mu.Unlock()
return nil