From efb2d2c878c2a6336058d6ef8258a97a5ec08fd1 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 5 Jun 2011 01:47:45 +0100 Subject: [PATCH] Don't check for root user on non-unix systems. --- SparkleLib/Makefile.am | 14 +++++++------- SparkleShare/SparkleShare.cs | 15 +++++++-------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/SparkleLib/Makefile.am b/SparkleLib/Makefile.am index 0cf13053..b29fa922 100644 --- a/SparkleLib/Makefile.am +++ b/SparkleLib/Makefile.am @@ -6,6 +6,12 @@ LINK = $(REF_SPARKLELIB) SOURCES = \ Defines.cs \ + Git/SparkleFetcherGit.cs \ + Git/SparkleRepoGit.cs \ + Hg/SparkleFetcherHg.cs \ + Hg/SparkleRepoHg.cs \ + Scp/SparkleFetcherScp.cs \ + Scp/SparkleRepoScp.cs \ SparkleBackend.cs \ SparkleChangeSet.cs \ SparkleConfig.cs \ @@ -15,13 +21,7 @@ SOURCES = \ SparkleListenerIrc.cs \ SparkleOptions.cs \ SparklePaths.cs \ - SparkleRepoBase.cs \ - Git/SparkleRepoGit.cs \ - Git/SparkleFetcherGit.cs \ - Hg/SparkleRepoHg.cs \ - Hg/SparkleFetcherHg.cs \ - Scp/SparkleFetcherScp.cs \ - Scp/SparkleRepoScp.cs + SparkleRepoBase.cs SMARTIRC4NET_FILES_EXPANDED = $(foreach file, $(SMARTIRC4NET_FILES), $(top_builddir)/$(file)) diff --git a/SparkleShare/SparkleShare.cs b/SparkleShare/SparkleShare.cs index 3b4d48b7..8a19f1dc 100644 --- a/SparkleShare/SparkleShare.cs +++ b/SparkleShare/SparkleShare.cs @@ -48,11 +48,14 @@ namespace SparkleShare { // Use translations Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR); - // Don't allow running as root - if (new UnixUserInfo (UnixEnvironment.UserName).UserId == 0) { + // Don't allow running as root on Linux or Mac + if ((SparkleShare.Platform == PlatformID.Unix || + SparkleShare.Platform == PlatformID.MacOSX) && + new UnixUserInfo (UnixEnvironment.UserName).UserId == 0) { + Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions.")); Console.WriteLine (_("Things would go utterly wrong.")); - Environment.Exit (0); + Environment.Exit (-1); } // Parse the command line options @@ -78,11 +81,10 @@ namespace SparkleShare { ShowHelp (p); // Load the right controller for the OS - string controller_name; + string controller_name = "Lin"; switch (SparkleShare.Platform) { case PlatformID.Unix: SetProcessName ("sparkleshare"); - controller_name = "Lin"; break; case PlatformID.MacOSX: controller_name = "Mac"; @@ -90,9 +92,6 @@ namespace SparkleShare { case PlatformID.Win32NT: controller_name = "Win"; break; - default: - controller_name = "Lin"; - break; } // Initialize the controller this way so that