daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
dd65c9
From d46ca2a3ed881bc9324ebd9da0a66af1133d43a7 Mon Sep 17 00:00:00 2001
181b3f
From: Michal Sekletar <msekletar@users.noreply.github.com>
181b3f
Date: Wed, 1 Nov 2017 02:25:48 -0700
181b3f
Subject: [PATCH] manager: fix connecting to bus when dbus is actually around
181b3f
 (#7205)
181b3f
181b3f
manager_connect_bus() is called *before* manager_coldplug(). As a last
181b3f
thing in service_coldplug() we set service state to
181b3f
s->deserialized_state, and thus before we do that all services are
181b3f
inactive and try_connect always evaluates to false. To fix that we must
181b3f
look at deserialized state instead of current unit state.
181b3f
181b3f
Fixes #7146
181b3f
181b3f
(cherry picked from commit 41dfa61d35c51a584437481d20541d5c3ccfa93d)
181b3f
181b3f
Related: #1465737
181b3f
---
181b3f
 src/core/manager.c | 2 +-
181b3f
 1 file changed, 1 insertion(+), 1 deletion(-)
181b3f
181b3f
diff --git a/src/core/manager.c b/src/core/manager.c
c62b8e
index 041fac46be..47b09e1e93 100644
181b3f
--- a/src/core/manager.c
181b3f
+++ b/src/core/manager.c
181b3f
@@ -809,7 +809,7 @@ static int manager_connect_bus(Manager *m, bool reexecuting) {
181b3f
         u = manager_get_unit(m, SPECIAL_DBUS_SERVICE);
181b3f
 
181b3f
         try_bus_connect =
181b3f
-                (u && UNIT_IS_ACTIVE_OR_RELOADING(unit_active_state(u))) &&
181b3f
+                (u && SERVICE(u)->deserialized_state == SERVICE_RUNNING) &&
181b3f
                 (reexecuting ||
181b3f
                 (m->running_as == SYSTEMD_USER && getenv("DBUS_SESSION_BUS_ADDRESS")));
181b3f