diff options
| -rw-r--r-- | internal/syscallcompat/thread_credentials.go | 28 | 
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/syscallcompat/thread_credentials.go b/internal/syscallcompat/thread_credentials.go index 3ef5233..8cfb703 100644 --- a/internal/syscallcompat/thread_credentials.go +++ b/internal/syscallcompat/thread_credentials.go @@ -19,6 +19,10 @@  // Note: _Gid_t is always uint32 on linux, so we can directly use uint32 for setgroups.  package syscallcompat +import ( +	"log" +) +  func Setgroups(gids []int) (err error) {  	if len(gids) == 0 {  		return setgroups(0, nil) @@ -30,3 +34,27 @@ func Setgroups(gids []int) (err error) {  	}  	return setgroups(len(a), &a[0])  } + +// SetgroupsPanic calls Setgroups and panics on error +func SetgroupsPanic(gids []int) { +	err := Setgroups(gids) +	if err != nil { +		log.Panic(err) +	} +} + +// SetregidPanic calls Setregid and panics on error +func SetregidPanic(rgid int, egid int) { +	err := Setregid(rgid, egid) +	if err != nil { +		log.Panic(err) +	} +} + +// SetreuidPanic calls Setreuid and panics on error +func SetreuidPanic(ruid int, euid int) { +	err := Setreuid(ruid, euid) +	if err != nil { +		log.Panic(err) +	} +}  | 
