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