summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-12-24 00:46:19 +0100
committerLennart Poettering <lennart@poettering.net>2015-12-24 00:46:19 +0100
commit7b8f930ce4b4b1f08f3066fe9bf971ccc1630be8 (patch)
tree7f124461ffa80a01fea918f7f64b807e19674cc8
parent838c669055ddbbd04998ffc345a81f6fddbb9cfe (diff)
parent8936a5e34dbfa9274348f3fef99f7c9f9327ddf9 (diff)
Merge pull request #2216 from zonque/nameownerchanged
core: re-sync bus name list after deserializing during daemon-reload
-rw-r--r--src/core/dbus.c4
-rw-r--r--src/core/dbus.h2
-rw-r--r--src/core/manager.c4
3 files changed, 8 insertions, 2 deletions
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 58069f59c3..1d89b9e250 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -734,7 +734,7 @@ static int bus_on_connection(sd_event_source *s, int fd, uint32_t revents, void
return 0;
}
-static int bus_list_names(Manager *m, sd_bus *bus) {
+int manager_sync_bus_names(Manager *m, sd_bus *bus) {
_cleanup_strv_free_ char **names = NULL;
const char *name;
Iterator i;
@@ -850,7 +850,7 @@ static int bus_setup_api(Manager *m, sd_bus *bus) {
if (r < 0)
return log_error_errno(r, "Failed to register name: %m");
- r = bus_list_names(m, bus);
+ r = manager_sync_bus_names(m, bus);
if (r < 0)
return r;
diff --git a/src/core/dbus.h b/src/core/dbus.h
index 4f06ad11c4..ff761668f3 100644
--- a/src/core/dbus.h
+++ b/src/core/dbus.h
@@ -34,6 +34,8 @@ void bus_track_serialize(sd_bus_track *t, FILE *f);
int bus_track_deserialize_item(char ***l, const char *line);
int bus_track_coldplug(Manager *m, sd_bus_track **t, char ***l);
+int manager_sync_bus_names(Manager *m, sd_bus *bus);
+
int bus_foreach_bus(Manager *m, sd_bus_track *subscribed2, int (*send_message)(sd_bus *bus, void *userdata), void *userdata);
int bus_verify_manage_units_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
diff --git a/src/core/manager.c b/src/core/manager.c
index e65616adc1..ffe27be743 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -2574,6 +2574,10 @@ int manager_reload(Manager *m) {
/* Third, fire things up! */
manager_coldplug(m);
+ /* Sync current state of bus names with our set of listening units */
+ if (m->api_bus)
+ manager_sync_bus_names(m, m->api_bus);
+
assert(m->n_reloading > 0);
m->n_reloading--;