anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0236-core-make-StopWhenUnneeded-work-in-conjunction-with-.patch

84b277
From bb586b571661bd77cafe0824efecdba502c99a98 Mon Sep 17 00:00:00 2001
84b277
From: Lennart Poettering <lennart@poettering.net>
84b277
Date: Thu, 13 Feb 2014 02:12:27 +0100
84b277
Subject: [PATCH] core: make StopWhenUnneeded work in conjunction with units
84b277
 that fail during their start job
84b277
84b277
https://bugzilla.redhat.com/show_bug.cgi?id=997031
84b277
84b277
Resolves: #986949
84b277
---
84b277
 src/core/unit.c | 9 +++++----
84b277
 1 file changed, 5 insertions(+), 4 deletions(-)
84b277
84b277
diff --git a/src/core/unit.c b/src/core/unit.c
84b277
index a4e6c18..17792d1 100644
84b277
--- a/src/core/unit.c
84b277
+++ b/src/core/unit.c
84b277
@@ -1455,7 +1455,9 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
84b277
          * sucessfully, since there's no change of state in that case. Which is
84b277
          * why it is handled in service_set_state() */
84b277
         if (UNIT_IS_INACTIVE_OR_FAILED(os) != UNIT_IS_INACTIVE_OR_FAILED(ns)) {
84b277
-                ExecContext *ec = unit_get_exec_context(u);
84b277
+                ExecContext *ec;
84b277
+
84b277
+                ec = unit_get_exec_context(u);
84b277
                 if (ec && exec_context_may_touch_console(ec)) {
84b277
                         if (UNIT_IS_INACTIVE_OR_FAILED(ns)) {
84b277
                                 m->n_on_console --;
84b277
@@ -1551,12 +1553,11 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
84b277
                 }
84b277
 
84b277
                 /* stop unneeded units regardless if going down was expected or not */
84b277
-                if (UNIT_IS_ACTIVE_OR_ACTIVATING(os) && UNIT_IS_INACTIVE_OR_DEACTIVATING(ns))
84b277
+                if (UNIT_IS_INACTIVE_OR_DEACTIVATING(ns))
84b277
                         check_unneeded_dependencies(u);
84b277
 
84b277
                 if (ns != os && ns == UNIT_FAILED) {
84b277
-                        log_notice_unit(u->id,
84b277
-                                        "Unit %s entered failed state.", u->id);
84b277
+                        log_notice_unit(u->id, "Unit %s entered failed state.", u->id);
84b277
                         unit_start_on_failure(u);
84b277
                 }
84b277
         }