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

Enrico Zini enrico at enricozini.org
Mon Feb 23 18:02:54 UTC 2009


The following commit has been merged in the master branch:
commit 255a133b7f12429dbce960e2cc0a6e0651f45237
Author: Enrico Zini <enrico at enricozini.org>
Date:   Mon Feb 23 16:39:12 2009 +0000

    Run self as session

diff --git a/Makefile.am b/Makefile.am
index cb430bc..a4adb12 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 
-bin_PROGRAMS = nodm
+sbin_PROGRAMS = nodm
 
 nodm_SOURCES = nodm.c
 nodm_LDFLAGS = $(PAM_LIBS)
+nodm_CFLAGS = -DNODM_SESSION='"$(sbindir)/nodm"'
 
 EXTRA_DIST = test_nodm TODO
diff --git a/nodm.c b/nodm.c
index e4fbbc9..9f107c9 100644
--- a/nodm.c
+++ b/nodm.c
@@ -47,7 +47,9 @@
 
 
 #define NAME "nodm"
-#define SESSION_CMD "/usr/sbin/nodm-session"
+#ifndef NODM_SESSION
+#define NODM_SESSION "/usr/sbin/nodm"
+#endif
 /* #define DEBUG_NODM */
 
 
@@ -378,7 +380,7 @@ static void monitor_cmdline_help(int argc, char** argv, FILE* out)
 	fprintf(out, "Usage: %s [options]\n\n", argv[0]);
 	fprintf(out, "Options:\n");
 	fprintf(out, " --help         print this help message\n");
-	fprintf(out, " --session=cmd  run cmd instead of %s\n", SESSION_CMD);
+	fprintf(out, " --session=cmd  run cmd instead of %s\n", NODM_SESSION);
 	fprintf(out, "                (use for testing)\n");
 }
 
@@ -395,7 +397,7 @@ static int nodm_monitor(int argc, char **argv)
 		{"session", required_argument, 0, 's'},
 		{0, 0, 0, 0}
 	};
-	const char* opt_session = SESSION_CMD;
+	const char* opt_session = NODM_SESSION;
 	char xinit[BUFSIZ];
 	char xoptions[BUFSIZ];
 	char* cp;
@@ -431,6 +433,7 @@ static int nodm_monitor(int argc, char **argv)
 	string_from_env(xinit, "NODM_XINIT", "/usr/bin/xinit");
 	string_from_env(xoptions, "NODM_X_OPTIONS", "");
 
+	setenv("NODM_RUN_SESSION", "1", 1);
 	run_and_restart(xinit, opt_session, xoptions[0] == 0 ? NULL : xoptions, mst);
 
 	return 0;
@@ -580,6 +583,7 @@ static int nodm_session(int argc, char **argv)
 	unsetenv("NODM_XSESSION");
 	unsetenv("NODM_X_OPTIONS");
 	unsetenv("NODM_MIN_SESSION_TIME");
+	unsetenv("NODM_RUN_SESSION");
 
 	chdir (pwent.pw_dir);
 
@@ -648,7 +652,7 @@ int main (int argc, char **argv)
 		return E_NOPERM;
 	}
 
-	if (ends_with(argv[0], "-session"))
+	if (getenv("NODM_RUN_SESSION") != NULL)
 	{
 		syslog(LOG_INFO, "Starting nodm X session");
 		ret = nodm_session(argc, argv);

-- 
Automatic Display Manager



More information about the pkg-fso-commits mailing list