[pkg-fso-commits] [SCM] Automatic Display Manager branch, master, updated. debian/0.1-60-g9b91fa4

Enrico Zini enrico at enricozini.org
Wed Feb 25 09:37:17 UTC 2009


The following commit has been merged in the master branch:
commit 3e5831be5903afb8d805be3d95457befc605903d
Author: Enrico Zini <enrico at enricozini.org>
Date:   Mon Feb 23 20:44:32 2009 +0000

    Allow to run --help and --version as non-root

diff --git a/nodm.c b/nodm.c
index 92334c5..93c12a9 100644
--- a/nodm.c
+++ b/nodm.c
@@ -434,6 +434,13 @@ static int nodm_monitor(int argc, char **argv)
 		return 0;
 	}
 
+	/* We only run if we are root */
+	if (getuid() != 0)
+	{
+		fprintf (stderr, _("%s: can only be run by root\n"), Prog);
+		return E_NOPERM;
+	}
+
 	syslog(LOG_INFO, "Starting nodm monitor");
 
 	/* Read the configuration from the environment */
@@ -462,6 +469,13 @@ static int nodm_session(int argc, char **argv)
 	char xsession[BUFSIZ];
 	const char* args[5];
 
+	/* We only run if we are root */
+	if (getuid() != 0)
+	{
+		fprintf (stderr, _("%s: can only be run by root\n"), Prog);
+		return E_NOPERM;
+	}
+
 	string_from_env(xsession, "NODM_XSESSION", "/etc/X11/Xsession");
 
 	/*
@@ -654,13 +668,6 @@ int main (int argc, char **argv)
 
 	// TODO command line processing
 
-	/* We only run if we are root */
-	if (getuid() != 0)
-	{
-		fprintf (stderr, _("%s: can only be run by root\n"), Prog);
-		return E_NOPERM;
-	}
-
 	if (getenv("NODM_RUN_SESSION") != NULL)
 	{
 		syslog(LOG_INFO, "Starting nodm X session");

-- 
Automatic Display Manager



More information about the pkg-fso-commits mailing list