Strconv for UID on windows doesn't work since UID is not an number on windows

There is no portable way to know, ignore root check for windows for now.
This commit is contained in:
Harshavardhana
2015-09-30 12:42:19 -07:00
parent 4671e01dbf
commit 0f51ca0a77
+5 -7
View File
@@ -32,15 +32,13 @@ import (
// Check for the user id erarly on and gracefully report.
func checkUser() {
u, e := user.Current()
_, e := user.Current()
fatalIf(probe.NewError(e), "Unable to determine current user.")
var uid int
uid, e = strconv.Atoi(u.Uid)
fatalIf(probe.NewError(e), "Unable to convert user id to an integer.")
if uid == 0 {
fatalIf(errDummy().Trace(), "Please run as a normal user, running as root is disallowed")
if runtime.GOOS != "windows" {
if os.Geteuid() == 0 {
fatalIf(errDummy().Trace(), "Please run as a normal user, running as root is disallowed")
}
}
}