summaryrefslogtreecommitdiff
path: root/src/login/logind.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/login/logind.c')
-rw-r--r--src/login/logind.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/login/logind.c b/src/login/logind.c
index 89e4eeea16..c99c2844e8 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -391,11 +391,21 @@ int manager_watch_busname(Manager *m, const char *name) {
}
void manager_drop_busname(Manager *m, const char *name) {
+ Session *session;
+ Iterator i;
char *key;
assert(m);
assert(name);
+ if (!hashmap_get(m->busnames, name))
+ return;
+
+ /* keep it if the name still owns a controller */
+ HASHMAP_FOREACH(session, m->sessions, i)
+ if (session_is_controller(session, name))
+ return;
+
key = hashmap_remove(m->busnames, name);
if (key)
free(key);