Use Mono.Unix instead of shelling out to whoami
This commit is contained in:
parent
172cbe1286
commit
75d770eb02
|
@ -51,9 +51,8 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't allow running as root
|
// Don't allow running as root
|
||||||
Process.StartInfo.FileName = "whoami";
|
UnixUserInfo UnixUserInfo = new UnixUserInfo (UnixEnvironment.UserName);
|
||||||
Process.Start ();
|
if (UnixUserInfo.UserId == 0) {
|
||||||
if (Process.StandardOutput.ReadToEnd ().Trim ().Equals ("root")) {
|
|
||||||
Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions."));
|
Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions."));
|
||||||
Console.WriteLine (_("Things will go utterly wrong."));
|
Console.WriteLine (_("Things will go utterly wrong."));
|
||||||
Environment.Exit (0);
|
Environment.Exit (0);
|
||||||
|
|
Loading…
Reference in a new issue