summaryrefslogtreecommitdiffhomepage
path: root/pkg/p9
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2019-01-31 11:29:55 -0800
committerShentubot <shentubot@google.com>2019-01-31 11:30:56 -0800
commitf1c1ee8a8ea6c0035aa799af3d7f5733fa2275d0 (patch)
tree5165562388c09d2c9826cb4a746e43dfaa47f71b /pkg/p9
parent2a0c69b19f4b55c3f9777f0098a72af123ccff3c (diff)
Don't mask out sticky bit to/from gofer
RELNOTES: sticky bit propagates to gofers now. PiperOrigin-RevId: 231822453 Change-Id: I73426170b9457350480a3b144a2baf937e7cb477
Diffstat (limited to 'pkg/p9')
-rw-r--r--pkg/p9/buffer.go4
-rw-r--r--pkg/p9/p9.go12
2 files changed, 10 insertions, 6 deletions
diff --git a/pkg/p9/buffer.go b/pkg/p9/buffer.go
index 9575ddf12..b7bb14ef9 100644
--- a/pkg/p9/buffer.go
+++ b/pkg/p9/buffer.go
@@ -144,7 +144,7 @@ func (b *buffer) ReadGID() GID {
// ReadPermissions reads a file mode value and applies the mask for permissions.
func (b *buffer) ReadPermissions() FileMode {
- return b.ReadFileMode() & PermissionsMask
+ return b.ReadFileMode() & permissionsMask
}
// ReadFileMode reads a file mode value.
@@ -230,7 +230,7 @@ func (b *buffer) WriteGID(gid GID) {
// WritePermissions applies a permissions mask and writes the FileMode.
func (b *buffer) WritePermissions(perm FileMode) {
- b.WriteFileMode(perm & PermissionsMask)
+ b.WriteFileMode(perm & permissionsMask)
}
// WriteFileMode writes a FileMode.
diff --git a/pkg/p9/p9.go b/pkg/p9/p9.go
index be644e7bf..9e8b7d467 100644
--- a/pkg/p9/p9.go
+++ b/pkg/p9/p9.go
@@ -130,8 +130,12 @@ const (
// Exec is a mode bit indicating exec permission.
Exec FileMode = 01
- // PermissionsMask is the mask to apply to FileModes for permissions.
- PermissionsMask FileMode = 0777
+ // AllPermissions is a mask with rwx bits set for user, group and others.
+ AllPermissions FileMode = 0777
+
+ // permissionsMask is the mask to apply to FileModes for permissions. It
+ // includes rwx bits for user, group and others, and sticky bit (01000).
+ permissionsMask FileMode = 01777
)
// QIDType is the most significant byte of the FileMode word, to be used as the
@@ -157,7 +161,7 @@ func (m FileMode) FileType() FileMode {
// Permissions returns just the permission bits of the mode.
func (m FileMode) Permissions() FileMode {
- return m & PermissionsMask
+ return m & permissionsMask
}
// Writable returns the mode with write bits added.
@@ -987,7 +991,7 @@ func (s *SetAttr) Encode(b *buffer) {
// Apply applies this to the given Attr.
func (a *Attr) Apply(mask SetAttrMask, attr SetAttr) {
if mask.Permissions {
- a.Mode = a.Mode&^PermissionsMask | (attr.Permissions & PermissionsMask)
+ a.Mode = a.Mode&^permissionsMask | (attr.Permissions & permissionsMask)
}
if mask.UID {
a.UID = attr.UID