[systemd-devel] [PATCH] transaction: if a job wants to be started before a target, set the target dead
Harald Hoyer
harald at redhat.com
Tue Mar 12 03:00:28 PDT 2013
Am 12.03.2013 10:51, schrieb harald at redhat.com:
> 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) {
>
This is of course completely wrong to do this here, but shows on my test
machine, that it would work, if done properly.
More information about the systemd-devel
mailing list