summaryrefslogtreecommitdiffhomepage
path: root/pkg/p9/p9.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/p9/p9.go')
-rw-r--r--pkg/p9/p9.go12
1 files changed, 8 insertions, 4 deletions
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