Commit c6382a33 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Add 0222 implicitly in Chmod as well.

parent 397fa2e1
......@@ -391,11 +391,11 @@ func (me *UnionFs) Chmod(name string, mode uint32) (code fuse.Status) {
if r.code != fuse.OK {
return r.code
}
if r.attr.Mode&fuse.S_IFREG == 0 {
return fuse.EPERM
}
permMask := uint32(07777)
// Always be writable.
mode |= 0222
oldMode := r.attr.Mode & permMask
if oldMode != mode {
......@@ -408,7 +408,7 @@ func (me *UnionFs) Chmod(name string, mode uint32) (code fuse.Status) {
}
me.fileSystems[0].Chmod(name, mode)
}
r.attr.Mode = (r.attr.Mode &^ 07777) | mode
r.attr.Mode = (r.attr.Mode &^ permMask) | mode
r.attr.Ctime_ns = time.Nanoseconds()
me.branchCache.Set(name, r)
return fuse.OK
......
......@@ -170,7 +170,7 @@ func TestChmod(t *testing.T) {
fi, err := os.Lstat(m_fn)
CheckSuccess(err)
if fi.Mode&07777 != 07070 {
if fi.Mode&07777 != 07272 {
t.Errorf("Unexpected mode found: %o", fi.Mode)
}
_, err = os.Lstat(wd + "/rw/file")
......
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