naccyde / rpms / systemd

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