summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-06-04 20:02:59 +0200
committerLennart Poettering <lennart@poettering.net>2018-06-07 13:36:19 +0200
commit9d4c195c6482b16528c5a25b85d42607bedffe3b (patch)
tree628bd181c88e0b9bb1fa0178ba4a310b5675c391
parentcore: log when unit_add_dependency() fails for some reason (diff)
downloadsystemd-9d4c195c6482b16528c5a25b85d42607bedffe3b.tar.xz
systemd-9d4c195c6482b16528c5a25b85d42607bedffe3b.zip
core: split out bus initialization from manager_setup()
-rw-r--r--src/core/manager.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 7fc31ce569..108110fee9 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1463,6 +1463,25 @@ static bool manager_dbus_is_running(Manager *m, bool deserialized) {
return true;
}
+static void manager_setup_bus(Manager *m) {
+ assert(m);
+
+ /* Let's set up our private bus connection now, unconditionally */
+ (void) bus_init_private(m);
+
+ /* If we are in --user mode also connect to the system bus now */
+ if (MANAGER_IS_USER(m))
+ (void) bus_init_system(m);
+
+ /* Let's connect to the bus now, but only if the unit is supposed to be up */
+ if (manager_dbus_is_running(m, MANAGER_IS_RELOADING(m))) {
+ (void) bus_init_api(m);
+
+ if (MANAGER_IS_SYSTEM(m))
+ (void) bus_init_system(m);
+ }
+}
+
int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
int r;
@@ -1543,20 +1562,8 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
/* This shouldn't fail, except if things are really broken. */
return r;
- /* Let's set up our private bus connection now, unconditionally */
- (void) bus_init_private(m);
-
- /* If we are in --user mode also connect to the system bus now */
- if (MANAGER_IS_USER(m))
- (void) bus_init_system(m);
-
- /* Let's connect to the bus now, but only if the unit is supposed to be up */
- if (manager_dbus_is_running(m, !!serialization)) {
- (void) bus_init_api(m);
-
- if (MANAGER_IS_SYSTEM(m))
- (void) bus_init_system(m);
- }
+ /* Connect to the bus if we are good for it */
+ manager_setup_bus(m);
/* Now that we are connected to all possible busses, let's deserialize who is tracking us. */
(void) bus_track_coldplug(m, &m->subscribed, false, m->deserialized_subscribed);