X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjob.c;h=54bd4147e293753dfae99e31c4c5309a98fbec87;hb=9b4f818bd8dd45029992f844d07a61c9977da720;hp=53c47d4a724fe8388f4878c0fa83596a7fbf1e25;hpb=5d44db4a905c62d6cf0dfabbf61df49621efec22;p=elogind.git diff --git a/src/job.c b/src/job.c index 53c47d4a7..54bd4147e 100644 --- a/src/job.c +++ b/src/job.c @@ -101,7 +101,7 @@ JobDependency* job_dependency_new(Job *subject, Job *object, bool matters, bool /* Adds a new job link, which encodes that the 'subject' job * needs the 'object' job in some way. If 'subject' is NULL * this means the 'anchor' job (i.e. the one the user - * explcitily asked for) is the requester. */ + * explicitly asked for) is the requester. */ if (!(l = new0(JobDependency, 1))) return NULL; @@ -461,8 +461,6 @@ int job_run_and_invalidate(Job *j) { j->state = JOB_WAITING; else if (r < 0) r = job_finish_and_invalidate(j, JOB_FAILED); - else - job_start_timer(j); } return r; @@ -504,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 */ @@ -551,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)