mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Don't mask out sticky bit to/from gofer
RELNOTES: sticky bit propagates to gofers now. PiperOrigin-RevId: 231822453 Change-Id: I73426170b9457350480a3b144a2baf937e7cb477
This commit is contained in:
committed by
Shentubot
parent
2a0c69b19f
commit
f1c1ee8a8e
+2
-2
@@ -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.
|
||||
|
||||
+8
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user