mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 06:05:06 +03:00
Update cmd/yggdrasil/chuser_unix.go
Co-authored-by: VNAT <xepjk@protonmail.com>
This commit is contained in:
parent
72fbe251b6
commit
87fa0a8936
1 changed files with 7 additions and 1 deletions
|
@ -49,7 +49,13 @@ func chuser(user string) error {
|
|||
|
||||
if g != nil {
|
||||
gid, _ := strconv.ParseUint(g.Gid, 10, 32)
|
||||
err := syscall.Setgid(int(uint32(gid)))
|
||||
var err error
|
||||
if gid < math.MaxInt {
|
||||
err = syscall.Setgid(int(gid))
|
||||
} else {
|
||||
err = errors.New("gid too big")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to setgid %d: %v", gid, err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue