]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/dbus-unit: use UNIT_IS_LOAD_ERROR where appropriate
authorMike Yuan <me@yhndnzj.com>
Thu, 30 May 2024 12:54:24 +0000 (20:54 +0800)
committerMike Yuan <me@yhndnzj.com>
Wed, 17 Jul 2024 15:25:20 +0000 (17:25 +0200)
src/core/dbus-unit.c

index 707644d2f9074b34073238d283fe4786a4bd26a3..0161a1bf4584db87c8aafd092276b5ab6dcc7fff 100644 (file)
@@ -1807,9 +1807,7 @@ int bus_unit_queue_job_one(
                         type = JOB_TRY_RELOAD;
         }
 
-        if (type == JOB_STOP &&
-            IN_SET(u->load_state, UNIT_NOT_FOUND, UNIT_ERROR, UNIT_BAD_SETTING) &&
-            unit_active_state(u) == UNIT_INACTIVE)
+        if (type == JOB_STOP && UNIT_IS_LOAD_ERROR(u->load_state) && unit_active_state(u) == UNIT_INACTIVE)
                 return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Unit %s not loaded.", u->id);
 
         if ((type == JOB_START && u->refuse_manual_start) ||