]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/unit: always propagate reload_result as job result, even if state is unexpected
authorMike Yuan <me@yhndnzj.com>
Sat, 15 Nov 2025 20:08:50 +0000 (21:08 +0100)
committerMike Yuan <me@yhndnzj.com>
Mon, 17 Nov 2025 18:26:11 +0000 (19:26 +0100)
The end state of unit shouldn't have any impact on reload job, as
either way the reload operation has been aborted.

src/core/unit.c

index 7675082e229cb52ae10d4b56dcc9621275853bf5..8a406a93341cdaff08878cde545bbb565fcf5b3b 100644 (file)
@@ -2649,9 +2649,7 @@ static bool unit_process_job(Job *j, UnitActiveState ns, bool reload_success) {
                                 job_finish_and_invalidate(j, reload_success ? JOB_DONE : JOB_FAILED, true, false);
                         else if (!IN_SET(ns, UNIT_ACTIVATING, UNIT_RELOADING, UNIT_REFRESHING)) {
                                 unexpected = true;
-
-                                if (UNIT_IS_INACTIVE_OR_FAILED(ns))
-                                        job_finish_and_invalidate(j, ns == UNIT_FAILED ? JOB_FAILED : JOB_CANCELED, true, false);
+                                job_finish_and_invalidate(j, reload_success ? JOB_CANCELED : JOB_FAILED, true, false);
                         }
                 }