Commit 74a78660 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

nodefs: don't tweak MemRegularFile mode

parent 58aa3140
......@@ -34,7 +34,6 @@ func (f *MemRegularFile) Open(ctx context.Context, flags uint32) (fh FileHandle,
func (f *MemRegularFile) Getattr(ctx context.Context, fh FileHandle, out *fuse.AttrOut) syscall.Errno {
out.Attr = f.Attr
out.Mode ^= 0222
out.Attr.Size = uint64(len(f.Data))
return OK
}
......
......@@ -46,6 +46,9 @@ func TestDataFile(t *testing.T) {
ctx,
&MemRegularFile{
Data: []byte(want),
Attr: fuse.Attr{
Mode: 0464,
},
},
NodeAttr{})
n.AddChild("file", ch, false)
......@@ -53,6 +56,15 @@ func TestDataFile(t *testing.T) {
})
defer clean()
var st syscall.Stat_t
if err := syscall.Lstat(mntDir+"/file", &st); err != nil {
t.Fatalf("Lstat: %v", err)
}
if want := uint32(syscall.S_IFREG | 0464); st.Mode != want {
t.Errorf("got mode %o, want %o", st.Mode, want)
}
fd, err := syscall.Open(mntDir+"/file", syscall.O_RDONLY, 0)
if err != nil {
t.Fatalf("Open: %v", err)
......
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