1 diff -aur nodm-0.7/nodm.c nodm-0.7-new/nodm.c
2 --- nodm-0.7/nodm.c 2009-07-26 20:36:14.000000000 +0200
3 +++ nodm-0.7-new/nodm.c 2011-03-02 15:19:23.960000382 +0100
6 * The minimum time (in seconds) that a session should last to be considered
9 + * Boolean option whether to restart X or not
11 -void run_and_restart(const char* xinit, const char* xsession, const char* xoptions, int mst)
12 +void run_and_restart(const char* xinit, const char* xsession, const char* xoptions, int mst, int xrestart)
14 static int retry_times[] = { 0, 0, 30, 30, 60, 60, -1 };
15 int restart_count = 0;
23 /* Run the X server */
24 time_t begin = time(NULL);
27 /* Sleep a bit if the session was too short */
28 sleep(retry_times[restart_count]);
29 syslog (LOG_INFO, "Restarting session for %s", name);
41 /* Parse command line options */
44 /* Read the configuration from the environment */
45 cp = getenv("NODM_MIN_SESSION_TIME");
46 mst = cp ? atoi(cp) : 60;
47 + cp = getenv("NODM_RESTART_SESSION");
48 + xrestart = cp ? atoi(cp) : 0;
49 string_from_env(xinit, "NODM_XINIT", "/usr/bin/xinit");
50 string_from_env(xoptions, "NODM_X_OPTIONS", "");
53 snprintf(xoptions1, BUFSIZ, "vt%d %s", vt_num, xoptions);
55 setenv("NODM_RUN_SESSION", "1", 1);
56 - run_and_restart(xinit, opt_session, xoptions1, mst);
57 + run_and_restart(xinit, opt_session, xoptions1, mst, xrestart);