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 = \ SOURCES = \
Defines.cs \ Defines.cs \
Git/SparkleFetcherGit.cs \
Git/SparkleRepoGit.cs \
Hg/SparkleFetcherHg.cs \
Hg/SparkleRepoHg.cs \
Scp/SparkleFetcherScp.cs \
Scp/SparkleRepoScp.cs \
SparkleBackend.cs \ SparkleBackend.cs \
SparkleChangeSet.cs \ SparkleChangeSet.cs \
SparkleConfig.cs \ SparkleConfig.cs \
@ -15,13 +21,7 @@ SOURCES = \
SparkleListenerIrc.cs \ SparkleListenerIrc.cs \
SparkleOptions.cs \ SparkleOptions.cs \
SparklePaths.cs \ SparklePaths.cs \
SparkleRepoBase.cs \ SparkleRepoBase.cs
Git/SparkleRepoGit.cs \
Git/SparkleFetcherGit.cs \
Hg/SparkleRepoHg.cs \
Hg/SparkleFetcherHg.cs \
Scp/SparkleFetcherScp.cs \
Scp/SparkleRepoScp.cs
SMARTIRC4NET_FILES_EXPANDED = $(foreach file, $(SMARTIRC4NET_FILES), $(top_builddir)/$(file)) SMARTIRC4NET_FILES_EXPANDED = $(foreach file, $(SMARTIRC4NET_FILES), $(top_builddir)/$(file))

View file

@ -48,11 +48,14 @@ namespace SparkleShare {
// Use translations // Use translations
Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR); Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR);
// Don't allow running as root // Don't allow running as root on Linux or Mac
if (new UnixUserInfo (UnixEnvironment.UserName).UserId == 0) { 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 (_("Sorry, you can't run SparkleShare with these permissions."));
Console.WriteLine (_("Things would go utterly wrong.")); Console.WriteLine (_("Things would go utterly wrong."));
Environment.Exit (0); Environment.Exit (-1);
} }
// Parse the command line options // Parse the command line options
@ -78,11 +81,10 @@ namespace SparkleShare {
ShowHelp (p); ShowHelp (p);
// Load the right controller for the OS // Load the right controller for the OS
string controller_name; string controller_name = "Lin";
switch (SparkleShare.Platform) { switch (SparkleShare.Platform) {
case PlatformID.Unix: case PlatformID.Unix:
SetProcessName ("sparkleshare"); SetProcessName ("sparkleshare");
controller_name = "Lin";
break; break;
case PlatformID.MacOSX: case PlatformID.MacOSX:
controller_name = "Mac"; controller_name = "Mac";
@ -90,9 +92,6 @@ namespace SparkleShare {
case PlatformID.Win32NT: case PlatformID.Win32NT:
controller_name = "Win"; controller_name = "Win";
break; break;
default:
controller_name = "Lin";
break;
} }
// Initialize the controller this way so that // Initialize the controller this way so that