Commit 152e6ac3 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fs: use SetAttrIn.GetFh() instead of SetAttrIn.Fh

On OSX, Fh apparently is non-zero sometimes, even with FATTR_FH unset.

Fixes #329

Change-Id: I4d9b6a83a3a8e8fa615dfbfa4d1b132b752528da
parent 53affd19
...@@ -431,11 +431,10 @@ func (b *rawBridge) getattr(ctx context.Context, n *Inode, f FileHandle, out *fu ...@@ -431,11 +431,10 @@ func (b *rawBridge) getattr(ctx context.Context, n *Inode, f FileHandle, out *fu
func (b *rawBridge) SetAttr(cancel <-chan struct{}, in *fuse.SetAttrIn, out *fuse.AttrOut) fuse.Status { func (b *rawBridge) SetAttr(cancel <-chan struct{}, in *fuse.SetAttrIn, out *fuse.AttrOut) fuse.Status {
ctx := &fuse.Context{Caller: in.Caller, Cancel: cancel} ctx := &fuse.Context{Caller: in.Caller, Cancel: cancel}
n, fEntry := b.inode(in.NodeId, in.Fh) fh, _ := in.GetFh()
n, fEntry := b.inode(in.NodeId, fh)
f := fEntry.file f := fEntry.file
if in.Valid&fuse.FATTR_FH == 0 {
f = nil
}
var errno = syscall.ENOTSUP var errno = syscall.ENOTSUP
if fops, ok := n.ops.(NodeSetattrer); ok { if fops, ok := n.ops.(NodeSetattrer); ok {
......
...@@ -159,6 +159,7 @@ type SetAttrInCommon struct { ...@@ -159,6 +159,7 @@ type SetAttrInCommon struct {
Unused5 uint32 Unused5 uint32
} }
// GetFh returns the file handle if available, or 0 if undefined.
func (s *SetAttrInCommon) GetFh() (uint64, bool) { func (s *SetAttrInCommon) GetFh() (uint64, bool) {
if s.Valid&FATTR_FH != 0 { if s.Valid&FATTR_FH != 0 {
return s.Fh, true return s.Fh, true
......
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