X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjob.c;h=46577fdf7a199384b50da6c19fd34e46c3feb4f1;hb=c0daa706d329d6cc593949b7d150d4972289ba93;hp=7470204710b2c3e282527a10b3a75a18145888b1;hpb=312732cfaf63b463b2062c47fddb2d639a5fe635;p=elogind.git diff --git a/src/job.c b/src/job.c index 747020471..46577fdf7 100644 --- a/src/job.c +++ b/src/job.c @@ -502,11 +502,11 @@ int job_finish_and_invalidate(Job *j, JobResult result) { t = j->type; job_free(j); - if (result == JOB_FAILED && j->type == JOB_START) + if (result == JOB_FAILED && t == JOB_START) unit_status_printf(u, "Starting %s " ANSI_HIGHLIGHT_ON "failed" ANSI_HIGHLIGHT_OFF ", see 'systemctl status %s' for details.\n", unit_description(u), u->meta.id); - else if (result == JOB_TIMEOUT && j->type == JOB_START) + else if (result == JOB_TIMEOUT && t == JOB_START) unit_status_printf(u, "Starting %s " ANSI_HIGHLIGHT_ON "timed out" ANSI_HIGHLIGHT_OFF ".\n", unit_description(u), u->meta.id); - else if (result == JOB_TIMEOUT && j->type == JOB_STOP) + else if (result == JOB_TIMEOUT && t == JOB_STOP) unit_status_printf(u, "Stopping %s " ANSI_HIGHLIGHT_ON "timed out" ANSI_HIGHLIGHT_OFF ".\n", unit_description(u), u->meta.id); /* Fail depending jobs on failure */ @@ -549,6 +549,13 @@ int job_finish_and_invalidate(Job *j, JobResult result) { } } + /* Trigger OnFailure dependencies that are not generated by + * the unit itself. We don't tread JOB_CANCELED as failure in + * this context. And JOB_FAILURE is already handled by the + * unit itself. */ + if (result == JOB_TIMEOUT || result == JOB_DEPENDENCY) + unit_trigger_on_failure(u); + /* Try to start the next jobs that can be started */ SET_FOREACH(other, u->meta.dependencies[UNIT_AFTER], i) if (other->meta.job)