diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-02-10 03:54:48 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-09 21:54:48 -0500 |
commit | 8367fea557cffaa6e870ccf1b94a063f560a922f (patch) | |
tree | de976851f800e9bc057c7c6ff6c5c8b60ee22517 /src/core/dbus.c | |
parent | d26fdaa236e9c6fd8e74e8644a47972be3a8ace4 (diff) | |
download | systemd-8367fea557cffaa6e870ccf1b94a063f560a922f.tar.gz |
core: make sure to destroy all name watching bus slots when we are kicked off the bus (#5294)
Fixes: #4528
Diffstat (limited to 'src/core/dbus.c')
-rw-r--r-- | src/core/dbus.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/dbus.c b/src/core/dbus.c index a3f701c064..0493e5786c 100644 --- a/src/core/dbus.c +++ b/src/core/dbus.c @@ -1041,6 +1041,7 @@ int bus_init(Manager *m, bool try_bus_connect) { static void destroy_bus(Manager *m, sd_bus **bus) { Iterator i; + Unit *u; Job *j; assert(m); @@ -1049,6 +1050,17 @@ static void destroy_bus(Manager *m, sd_bus **bus) { if (!*bus) return; + /* Make sure all bus slots watching names are released. */ + HASHMAP_FOREACH(u, m->watch_bus, i) { + if (!u->match_bus_slot) + continue; + + if (sd_bus_slot_get_bus(u->match_bus_slot) != *bus) + continue; + + u->match_bus_slot = sd_bus_slot_unref(u->match_bus_slot); + } + /* Get rid of tracked clients on this bus */ if (m->subscribed && sd_bus_track_get_bus(m->subscribed) == *bus) m->subscribed = sd_bus_track_unref(m->subscribed); |