diff options
Diffstat (limited to 'cap')
-rw-r--r-- | cap/convenience.go | 4 | ||||
-rw-r--r-- | cap/legacy.go | 7 | ||||
-rw-r--r-- | cap/modern.go | 8 |
3 files changed, 17 insertions, 2 deletions
diff --git a/cap/convenience.go b/cap/convenience.go index d60b2d6..9dd9d07 100644 --- a/cap/convenience.go +++ b/cap/convenience.go @@ -236,7 +236,7 @@ func SetGroups(gid int, suppl ...int) error { return err } if len(suppl) == 0 { - if _, _, err := callWKernel(syscall.SYS_SETGROUPS, 0, 0, 0); err != 0 { + if _, _, err := callWKernel(sys_setgroups_variant, 0, 0, 0); err != 0 { return err } return nil @@ -247,7 +247,7 @@ func SetGroups(gid int, suppl ...int) error { for i, g := range suppl { gs[i] = uint32(g) } - if _, _, err := callWKernel(syscall.SYS_SETGROUPS, uintptr(len(suppl)), uintptr(unsafe.Pointer(&gs[0])), 0); err != 0 { + if _, _, err := callWKernel(sys_setgroups_variant, uintptr(len(suppl)), uintptr(unsafe.Pointer(&gs[0])), 0); err != 0 { return err } return nil diff --git a/cap/legacy.go b/cap/legacy.go new file mode 100644 index 0000000..7bdf9b4 --- /dev/null +++ b/cap/legacy.go @@ -0,0 +1,7 @@ +// +build linux,arm linux,386 + +package cap + +import "syscall" + +var sys_setgroups_variant = uintptr(syscall.SYS_SETGROUPS32) diff --git a/cap/modern.go b/cap/modern.go new file mode 100644 index 0000000..04a4919 --- /dev/null +++ b/cap/modern.go @@ -0,0 +1,8 @@ +// +build linux,!arm +// +build linux,!386 + +package cap + +import "syscall" + +var sys_setgroups_variant = uintptr(syscall.SYS_SETGROUPS) |