summaryrefslogtreecommitdiff
path: root/src/machine/machined-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/machine/machined-dbus.c
parent286ca4852eb2efc5c8c405e585b4e886c538f538 (diff)
logind/machined: properly notice when units are gc'ed
Diffstat (limited to 'src/machine/machined-dbus.c')
-rw-r--r--src/machine/machined-dbus.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
index a81f37c5ca..1b1eb3a333 100644
--- a/src/machine/machined-dbus.c
+++ b/src/machine/machined-dbus.c
@@ -531,7 +531,6 @@ DBusHandlerResult bus_message_filter(
goto finish;
}
-
mm = hashmap_get(m->machine_units, unit);
if (mm) {
if (streq_ptr(path, mm->scope_job)) {
@@ -570,6 +569,27 @@ DBusHandlerResult bus_message_filter(
if (mm)
machine_add_to_gc_queue(mm);
}
+
+ } else if (dbus_message_is_signal(message, "org.freedesktop.systemd1.Manager", "UnitRemoved")) {
+ const char *path, *unit;
+ Machine *mm;
+
+ 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;
+ }
+
+ mm = hashmap_get(m->machine_units, unit);
+ if (mm) {
+ hashmap_remove(m->machine_units, mm->scope);
+ free(mm->scope);
+ mm->scope = NULL;
+
+ machine_add_to_gc_queue(mm);
+ }
}
finish: