summaryrefslogtreecommitdiff
path: root/src/login/logind-dbus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-07-03 15:12:58 +0200
committerLennart Poettering <lennart@poettering.net>2013-07-03 15:14:47 +0200
commit943aca8efb39453e3994ccdd1e08534b788c5aee (patch)
tree2934f322907fada7fabbadece9e76389d6585b44 /src/login/logind-dbus.c
parent286ca4852eb2efc5c8c405e585b4e886c538f538 (diff)
logind/machined: properly notice when units are gc'ed
Diffstat (limited to 'src/login/logind-dbus.c')
-rw-r--r--src/login/logind-dbus.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index a52f020b34..eeff84394e 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -2411,6 +2411,44 @@ DBusHandlerResult bus_message_filter(
if (u)
user_add_to_gc_queue(u);
}
+ } else if (dbus_message_is_signal(message, "org.freedesktop.systemd1.Manager", "UnitRemoved")) {
+
+ const char *path, *unit;
+ Session *session;
+ User *user;
+
+ if (!dbus_message_get_args(message, &error,
+ DBUS_TYPE_STRING, &unit,
+ DBUS_TYPE_OBJECT_PATH, &path,
+ DBUS_TYPE_INVALID)) {
+ log_error("Failed to parse UnitRemoved message: %s", bus_error_message(&error));
+ goto finish;
+ }
+
+ session = hashmap_get(m->session_units, unit);
+ if (session) {
+ hashmap_remove(m->session_units, session->scope);
+ free(session->scope);
+ session->scope = NULL;
+
+ session_add_to_gc_queue(session);
+ }
+
+ user = hashmap_get(m->user_units, unit);
+ if (user) {
+
+ if (streq_ptr(unit, user->service)) {
+ hashmap_remove(m->user_units, user->service);
+ free(user->service);
+ user->service = NULL;
+ } else if (streq_ptr(unit, user->slice)) {
+ hashmap_remove(m->user_units, user->slice);
+ free(user->slice);
+ user->slice = NULL;
+ }
+
+ user_add_to_gc_queue(user);
+ }
}
finish: