summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2014-11-28 06:04:48 +0100
committerMichael Biebl <biebl@debian.org>2015-01-07 19:08:58 +0100
commit1ed0c19f81fd13cdf283c6def0168ce122a853a9 (patch)
treec40d8eb3b42710652a2bbf2b96dfe08e0f69bd5b
parent6ce02c2a3a2aa888c3e074ae235d94808a165f9a (diff)
sysv-generator: initialize units before use to ensure correct ordering
The original loop called fix_order() on each service immediately after loading it, but fix_order() would reference other units which were not loaded yet. This resulted in bogus and unnecessary orderings based on the static start priorities. Therefore call load_sysv() for every init script when traversing them in enumerate_sysv(). This ensures that all units are loaded when fix_order() is called. Bug-Debian: https://bugs.debian.org/771118
-rw-r--r--src/sysv-generator/sysv-generator.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index f78ddebf46..2f24ef2561 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -755,6 +755,10 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
service->name = name;
service->path = fpath;
+ r = load_sysv(service);
+ if (r < 0)
+ continue;
+
r = hashmap_put(all_services, service->name, service);
if (r < 0)
return log_oom();
@@ -939,10 +943,6 @@ int main(int argc, char *argv[]) {
}
HASHMAP_FOREACH(service, all_services, j) {
- q = load_sysv(service);
- if (q < 0)
- continue;
-
q = fix_order(service, all_services);
if (q < 0)
continue;