]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/unit: no need to handle intermediate job types in unit_process_job()
authorMike Yuan <me@yhndnzj.com>
Sun, 16 Nov 2025 14:59:28 +0000 (15:59 +0100)
committerMike Yuan <me@yhndnzj.com>
Mon, 17 Nov 2025 18:25:41 +0000 (19:25 +0100)
Installed jobs are always collapsed, i.e. can only be of types
accepted by job_run_and_invalidate() modulo JOB_NOP which is
stored in Unit.nop_job (if any). Let's trim the unreachable
branches.

src/core/unit.c

index a85987c74bfc915b96d3cba40c642ad655213d83..b6dc962f86611b1b352c0f4c6aca4688a273ba1b 100644 (file)
@@ -2610,6 +2610,7 @@ static bool unit_process_job(Job *j, UnitActiveState ns, bool reload_success) {
         JobResult result;
 
         assert(j);
+        assert(j->installed);
 
         if (j->state == JOB_WAITING)
                 /* So we reached a different state for this job. Let's see if we can run it now if it failed previously
@@ -2642,8 +2643,6 @@ static bool unit_process_job(Job *j, UnitActiveState ns, bool reload_success) {
                 break;
 
         case JOB_RELOAD:
-        case JOB_RELOAD_OR_START:
-        case JOB_TRY_RELOAD:
 
                 if (j->state == JOB_RUNNING) {
                         if (ns == UNIT_ACTIVE)
@@ -2660,7 +2659,6 @@ static bool unit_process_job(Job *j, UnitActiveState ns, bool reload_success) {
 
         case JOB_STOP:
         case JOB_RESTART:
-        case JOB_TRY_RESTART:
 
                 if (UNIT_IS_INACTIVE_OR_FAILED(ns))
                         job_finish_and_invalidate(j, JOB_DONE, true, false);