+ app: unix, windows: require root user on first launch

This commit is contained in:
Simon Zolin
2019-04-01 12:22:54 +03:00
parent 1611057852
commit e4b53db558
3 changed files with 76 additions and 9 deletions

View File

@@ -3,6 +3,7 @@
package main
import (
"os"
"syscall"
"github.com/AdguardTeam/golibs/log"
@@ -19,3 +20,8 @@ func setRlimit(val uint) {
log.Error("Setrlimit() failed: %v", err)
}
}
// Check if the current user has root (administrator) rights
func haveAdminRights() (bool, error) {
return os.Getuid() == 0, nil
}