Merge lp:~jamesodhunt/upstart/bug-1338637 into lp:upstart

Proposed by James Hunt on 2014-07-08
Status: Merged
Merged at revision: 1643
Proposed branch: lp:~jamesodhunt/upstart/bug-1338637
Merge into: lp:upstart
Diff against target: 104 lines (+47/-32)
2 files modified
ChangeLog (+6/-0)
init/main.c (+41/-32)
To merge this branch: bzr merge lp:~jamesodhunt/upstart/bug-1338637
Reviewer Review Type Date Requested Status
Upstart Reviewers 2014-07-08 Pending
Review via email: mp+225945@code.launchpad.net
To post a comment you must log in.
Dimitri John Ledkov (xnox) wrote :

ouch!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2014-07-07 10:15:25 +0000
3+++ ChangeLog 2014-07-08 10:07:29 +0000
4@@ -1,3 +1,9 @@
5+2014-07-08 James Hunt <james.hunt@ubuntu.com>
6+
7+ * init/main.c: main():
8+ - Only create inotify watches if not restarting or if performing a
9+ stateless re-exec (LP: #1338637).
10+
11 2014-07-07 James Hunt <james.hunt@ubuntu.com>
12
13 * init/tests/test_job_process.c: test_handler():
14
15=== modified file 'init/main.c'
16--- init/main.c 2014-06-05 22:35:01 +0000
17+++ init/main.c 2014-07-08 10:07:29 +0000
18@@ -601,38 +601,44 @@
19 }
20 }
21
22- /* Read configuration */
23- if (prepend_conf_dirs[0]) {
24- for (char **d = prepend_conf_dirs; d && *d; d++) {
25- nih_debug ("Prepending configuration directory %s", *d);
26- NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
27- }
28- }
29-
30- if (! user_mode) {
31- nih_assert (conf_dirs[0]);
32-
33- NIH_MUST (conf_source_new (NULL, CONFFILE, CONF_FILE));
34-
35- for (char **d = conf_dirs; d && *d; d++) {
36- nih_debug ("Using configuration directory %s", *d);
37- NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
38- }
39- } else {
40- nih_local char **dirs = NULL;
41-
42- dirs = NIH_MUST (get_user_upstart_dirs ());
43-
44- for (char **d = conf_dirs[0] ? conf_dirs : dirs; d && *d; d++) {
45- nih_debug ("Using configuration directory %s", *d);
46- NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
47- }
48- }
49-
50- if (append_conf_dirs[0]) {
51- for (char **d = append_conf_dirs; d && *d; d++) {
52- nih_debug ("Adding configuration directory %s", *d);
53- NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
54+ /* Only honour command-line options affecting configuration
55+ * directories if not restarting, or if performing a stateless
56+ * re-exec.
57+ */
58+ if (! restart || (restart && state_fd == -1)) {
59+ /* Read configuration */
60+ if (prepend_conf_dirs[0]) {
61+ for (char **d = prepend_conf_dirs; d && *d; d++) {
62+ nih_debug ("Prepending configuration directory %s", *d);
63+ NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
64+ }
65+ }
66+
67+ if (! user_mode) {
68+ nih_assert (conf_dirs[0]);
69+
70+ NIH_MUST (conf_source_new (NULL, CONFFILE, CONF_FILE));
71+
72+ for (char **d = conf_dirs; d && *d; d++) {
73+ nih_debug ("Using configuration directory %s", *d);
74+ NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
75+ }
76+ } else {
77+ nih_local char **dirs = NULL;
78+
79+ dirs = NIH_MUST (get_user_upstart_dirs ());
80+
81+ for (char **d = conf_dirs[0] ? conf_dirs : dirs; d && *d; d++) {
82+ nih_debug ("Using configuration directory %s", *d);
83+ NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
84+ }
85+ }
86+
87+ if (append_conf_dirs[0]) {
88+ for (char **d = append_conf_dirs; d && *d; d++) {
89+ nih_debug ("Adding configuration directory %s", *d);
90+ NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR));
91+ }
92 }
93 }
94
95@@ -644,6 +650,9 @@
96
97 conf_reload ();
98
99+ /* We must have atleast one source of configuration */
100+ nih_assert (! NIH_LIST_EMPTY (conf_sources));
101+
102 /* Create a listening server for private connections. */
103 if (use_session_bus == FALSE) {
104 while (control_server_open () < 0) {

Subscribers

People subscribed via source and target branches