Don't check for root user on non-unix systems.

This commit is contained in:
Hylke Bons 2011-06-05 01:47:45 +01:00
parent 6b94709bfe
commit efb2d2c878
2 changed files with 14 additions and 15 deletions

View file

@ -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))

View file

@ -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