mirror of
https://github.com/yggdrasil-network/yggdrasil-go
synced 2024-11-09 23:20:26 +03:00
Update cmd/yggdrasil/chuser_unix.go
Co-authored-by: VNAT <xepjk@protonmail.com>
This commit is contained in:
parent
87fa0a8936
commit
cb29747e43
@ -69,7 +69,13 @@ func chuser(user string) error {
|
||||
|
||||
if u != nil {
|
||||
uid, _ := strconv.ParseUint(u.Uid, 10, 32)
|
||||
err := syscall.Setuid(int(uint32(uid)))
|
||||
var err error
|
||||
if uid < math.MaxInt {
|
||||
err = syscall.Setuid(int(uid))
|
||||
} else {
|
||||
err = errors.New("uid too big")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to setuid %d: %v", uid, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user