core/dbus-unit: use UNIT_IS_LOAD_ERROR where appropriate

This commit is contained in:
Mike Yuan
2024-07-17 17:25:20 +02:00
parent d9b1ec27f7
commit 4e8b11ca16
+1 -3
View 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) ||