X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fjob.c;h=0a9ce153f697a9521b5b53efd32d51ee19d9b1f8;hp=8273a39c350c609f280baf49a57a4dd1d92d2171;hb=f60f22dfbb8cfa0eb55d1896db0e4c3f7d3cfacb;hpb=6124958c7bda3fed9b079e8217781480797703f5 diff --git a/src/job.c b/src/job.c index 8273a39c3..0a9ce153f 100644 --- a/src/job.c +++ b/src/job.c @@ -76,6 +76,7 @@ void job_free(Job *j) { if (j->in_dbus_queue) LIST_REMOVE(Job, dbus_queue, j->manager->dbus_job_queue, j); + free(j->bus_client); free(j); } @@ -275,26 +276,26 @@ bool job_type_is_redundant(JobType a, UnitActiveState b) { case JOB_START: return b == UNIT_ACTIVE || - b == UNIT_ACTIVE_RELOADING; + b == UNIT_RELOADING; case JOB_STOP: return b == UNIT_INACTIVE || - b == UNIT_INACTIVE_MAINTENANCE; + b == UNIT_MAINTENANCE; case JOB_VERIFY_ACTIVE: return b == UNIT_ACTIVE || - b == UNIT_ACTIVE_RELOADING; + b == UNIT_RELOADING; case JOB_RELOAD: return - b == UNIT_ACTIVE_RELOADING; + b == UNIT_RELOADING; case JOB_RELOAD_OR_START: return b == UNIT_ACTIVATING || - b == UNIT_ACTIVE_RELOADING; + b == UNIT_RELOADING; case JOB_RESTART: return @@ -416,7 +417,7 @@ int job_run_and_invalidate(Job *j) { case JOB_RESTART: { UnitActiveState t = unit_active_state(j->unit); - if (t == UNIT_INACTIVE || t == UNIT_INACTIVE_MAINTENANCE || t == UNIT_ACTIVATING) { + if (t == UNIT_INACTIVE || t == UNIT_MAINTENANCE || t == UNIT_ACTIVATING) { j->type = JOB_START; r = unit_start(j->unit); } else @@ -426,7 +427,7 @@ int job_run_and_invalidate(Job *j) { case JOB_TRY_RESTART: { UnitActiveState t = unit_active_state(j->unit); - if (t == UNIT_INACTIVE || t == UNIT_INACTIVE_MAINTENANCE || t == UNIT_DEACTIVATING) + if (t == UNIT_INACTIVE || t == UNIT_MAINTENANCE || t == UNIT_DEACTIVATING) r = -ENOEXEC; else if (t == UNIT_ACTIVATING) { j->type = JOB_START; @@ -482,6 +483,9 @@ int job_finish_and_invalidate(Job *j, bool success) { t = j->type; job_free(j); + if (!success) + unit_status_printf(u, "Starting %s " ANSI_HIGHLIGHT_ON "failed" ANSI_HIGHLIGHT_OFF ".\n", unit_description(u)); + /* Fail depending jobs on failure */ if (!success) { @@ -544,10 +548,9 @@ void job_add_to_dbus_queue(Job *j) { if (j->in_dbus_queue) return; - if (set_isempty(j->manager->subscribed)) { - j->sent_dbus_new_signal = true; - return; - } + /* We don't check if anybody is subscribed here, since this + * job might just have been created and not yet assigned to a + * connection/client. */ LIST_PREPEND(Job, dbus_queue, j->manager->dbus_job_queue, j); j->in_dbus_queue = true;