diff options
Diffstat (limited to 'src/core/target.c')
-rw-r--r-- | src/core/target.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/target.c b/src/core/target.c index 6446767504..421a304c73 100644 --- a/src/core/target.c +++ b/src/core/target.c @@ -1,12 +1,14 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ #include "dbus-target.h" +#include "dbus-unit.h" #include "log.h" +#include "serialize.h" #include "special.h" #include "string-util.h" +#include "target.h" #include "unit-name.h" #include "unit.h" -#include "target.h" static const UnitActiveState state_translation_table[_TARGET_STATE_MAX] = { [TARGET_DEAD] = UNIT_INACTIVE, @@ -17,6 +19,9 @@ static void target_set_state(Target *t, TargetState state) { TargetState old_state; assert(t); + if (t->state != state) + bus_unit_send_pending_change_signal(UNIT(t), false); + old_state = t->state; t->state = state; @@ -66,7 +71,7 @@ static int target_add_default_dependencies(Target *t) { return 0; /* Make sure targets are unloaded on shutdown */ - return unit_add_two_dependencies_by_name(UNIT(t), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true, UNIT_DEPENDENCY_DEFAULT); + return unit_add_two_dependencies_by_name(UNIT(t), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, true, UNIT_DEPENDENCY_DEFAULT); } static int target_load(Unit *u) { @@ -144,7 +149,7 @@ static int target_serialize(Unit *u, FILE *f, FDSet *fds) { assert(f); assert(fds); - unit_serialize_item(u, f, "state", target_state_to_string(s->state)); + (void) serialize_item(f, "state", target_state_to_string(s->state)); return 0; } |