}
void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_success) {
- const char *reason;
- Manager *m;
-
assert(u);
assert(os < _UNIT_ACTIVE_STATE_MAX);
assert(ns < _UNIT_ACTIVE_STATE_MAX);
* UnitActiveState! That means that ns == os is an expected behavior here. For example: if a mount point is
* remounted this function will be called too! */
- m = u->manager;
+ Manager *m = ASSERT_PTR(u->manager);
/* Let's enqueue the change signal early. In case this unit has a job associated we want that this unit is in
* the bus queue, so that any job change signal queued will force out the unit change signal first. */
unit_trigger_notify(u);
if (!MANAGER_IS_RELOADING(m)) {
+ const char *reason;
+
if (os != UNIT_FAILED && ns == UNIT_FAILED) {
reason = strjoina("unit ", u->id, " failed");
emergency_action(m, u->failure_action, 0, u->reboot_arg, unit_failure_action_exit_status(u), reason);