[systemd-devel] [PATCH] transaction: if a job wants to be started before a target, set the target dead

harald at redhat.com harald at redhat.com
Tue Mar 12 02:51:06 PDT 2013


From: Harald Hoyer <harald at redhat.com>

Not sure, if this is the correct place to enforce this, but it seems to
work.
---
 src/core/transaction.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/core/transaction.c b/src/core/transaction.c
index 4a8d90e..3fed57a 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -915,6 +915,13 @@ int transaction_add_job_and_dependencies(
 
                 /* Finally, recursively add in all dependencies. */
                 if (type == JOB_START || type == JOB_RESTART) {
+                        SET_FOREACH(dep, ret->unit->dependencies[UNIT_BEFORE], i) {
+                                if (dep->type == UNIT_TARGET) {
+                                        Target *t = TARGET(dep);
+                                        t->state = TARGET_DEAD;
+                                }
+                        }
+
                         SET_FOREACH(dep, ret->unit->dependencies[UNIT_REQUIRES], i) {
                                 r = transaction_add_job_and_dependencies(tr, JOB_START, dep, ret, true, override, false, false, ignore_order, e);
                                 if (r < 0) {
-- 
1.8.1



More information about the systemd-devel mailing list