Merge authors:
  James Hunt (jamesodhunt)
Related merge proposals:
  https://code.launchpad.net/~jamesodhunt/upstart/bug-1338637/+merge/225945
  proposed by: James Hunt (jamesodhunt)
------------------------------------------------------------
revno: 1643 [merge]
fixes bug: https://launchpad.net/bugs/1338637
committer: Dimitri John Ledkov <dimitri.led...@canonical.com>
branch nick: trunk
timestamp: Tue 2014-07-08 12:22:14 +0100
message:
  Merge lp:~jamesodhunt/upstart/bug-1338637
modified:
  ChangeLog
  init/main.c


--
lp:upstart
https://code.launchpad.net/~upstart-devel/upstart/trunk

Your team Upstart Reviewers is subscribed to branch lp:upstart.
To unsubscribe from this branch go to 
https://code.launchpad.net/~upstart-devel/upstart/trunk/+edit-subscription
=== modified file 'ChangeLog'
--- ChangeLog	2014-07-07 10:15:25 +0000
+++ ChangeLog	2014-07-08 10:02:43 +0000
@@ -1,3 +1,9 @@
+2014-07-08  James Hunt  <james.h...@ubuntu.com>
+
+	* init/main.c: main():
+	  - Only create inotify watches if not restarting or if performing a
+	    stateless re-exec (LP: #1338637).
+
 2014-07-07  James Hunt  <james.h...@ubuntu.com>
 
 	* init/tests/test_job_process.c: test_handler():

=== modified file 'init/main.c'
--- init/main.c	2014-06-05 22:35:01 +0000
+++ init/main.c	2014-07-08 10:02:43 +0000
@@ -601,38 +601,44 @@
 		}
 	}
 
-	/* Read configuration */
-	if (prepend_conf_dirs[0]) {
-		for (char **d = prepend_conf_dirs; d && *d; d++) {
-			nih_debug ("Prepending configuration directory %s", *d);
-			NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
-		}
-	}
-
-	if (! user_mode) {
-		nih_assert (conf_dirs[0]);
-
-		NIH_MUST (conf_source_new (NULL, CONFFILE, CONF_FILE));
-
-		for (char **d = conf_dirs; d && *d; d++) {
-			nih_debug ("Using configuration directory %s", *d);
-			NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
-		}
-	} else {
-		nih_local char **dirs = NULL;
-
-		dirs = NIH_MUST (get_user_upstart_dirs ());
-
-		for (char **d = conf_dirs[0] ? conf_dirs : dirs; d && *d; d++) {
-			nih_debug ("Using configuration directory %s", *d);
-			NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
-		}
-	}
-
-	if (append_conf_dirs[0]) {
-		for (char **d = append_conf_dirs; d && *d; d++) {
-			nih_debug ("Adding configuration directory %s", *d);
-			NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
+	/* Only honour command-line options affecting configuration
+	 * directories if not restarting, or if performing a stateless
+	 * re-exec.
+	 */
+	if (! restart || (restart && state_fd == -1)) {
+		/* Read configuration */
+		if (prepend_conf_dirs[0]) {
+			for (char **d = prepend_conf_dirs; d && *d; d++) {
+				nih_debug ("Prepending configuration directory %s", *d);
+				NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
+			}
+		}
+
+		if (! user_mode) {
+			nih_assert (conf_dirs[0]);
+
+			NIH_MUST (conf_source_new (NULL, CONFFILE, CONF_FILE));
+
+			for (char **d = conf_dirs; d && *d; d++) {
+				nih_debug ("Using configuration directory %s", *d);
+				NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
+			}
+		} else {
+			nih_local char **dirs = NULL;
+
+			dirs = NIH_MUST (get_user_upstart_dirs ());
+
+			for (char **d = conf_dirs[0] ? conf_dirs : dirs; d && *d; d++) {
+				nih_debug ("Using configuration directory %s", *d);
+				NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
+			}
+		}
+
+		if (append_conf_dirs[0]) {
+			for (char **d = append_conf_dirs; d && *d; d++) {
+				nih_debug ("Adding configuration directory %s", *d);
+				NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
+			}
 		}
 	}
 
@@ -644,6 +650,9 @@
 
 	conf_reload ();
 
+	/* We must have atleast one source of configuration */
+	nih_assert (! NIH_LIST_EMPTY (conf_sources));
+
 	/* Create a listening server for private connections. */
 	if (use_session_bus == FALSE) {
 		while (control_server_open () < 0) {

-- 
upstart-devel mailing list
upstart-devel@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to