From 75d770eb02754c6ef9e8c6fe6bdc70cd090aeb3f Mon Sep 17 00:00:00 2001 From: Simon Pither Date: Mon, 14 Jun 2010 10:14:00 +0100 Subject: [PATCH] Use Mono.Unix instead of shelling out to whoami --- SparkleShare/SparkleShare.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/SparkleShare/SparkleShare.cs b/SparkleShare/SparkleShare.cs index cded1aed..636e23ea 100644 --- a/SparkleShare/SparkleShare.cs +++ b/SparkleShare/SparkleShare.cs @@ -51,9 +51,8 @@ namespace SparkleShare { } // Don't allow running as root - Process.StartInfo.FileName = "whoami"; - Process.Start (); - if (Process.StandardOutput.ReadToEnd ().Trim ().Equals ("root")) { + UnixUserInfo UnixUserInfo = new UnixUserInfo (UnixEnvironment.UserName); + if (UnixUserInfo.UserId == 0) { Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions.")); Console.WriteLine (_("Things will go utterly wrong.")); Environment.Exit (0);