summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-05-15 01:15:30 +0200
committerLennart Poettering <lennart@poettering.net>2014-05-15 01:15:30 +0200
commit19befb2d5fc087f96e40ddc432b2cc9385666209 (patch)
tree4a28a54ed25ba8fb57578f639b2691749c9c935e /src/systemctl
parent9a78148e40402b44f361f4fbf63bb97a21aeac0b (diff)
sd-bus: introduce sd_bus_slot objects encapsulating callbacks or vtables attached to a bus connection
This makes callback behaviour more like sd-event or sd-resolve, and creates proper object for unregistering callbacks. Taking the refernce to the slot is optional. If not taken life time of the slot will be bound to the underlying bus object (or in the case of an async call until the reply has been recieved).
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index e1e4640ae8..91d8032945 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2305,6 +2305,7 @@ static int enable_wait_for_jobs(sd_bus *bus) {
r = sd_bus_add_match(
bus,
+ NULL,
"type='signal',"
"sender='org.freedesktop.systemd1',"
"interface='org.freedesktop.systemd1.Manager',"
@@ -2364,13 +2365,14 @@ static int check_wait_response(WaitData *d) {
}
static int wait_for_jobs(sd_bus *bus, Set *s) {
+ _cleanup_bus_slot_unref_ sd_bus_slot *slot = NULL;
WaitData d = { .set = s };
int r = 0, q;
assert(bus);
assert(s);
- q = sd_bus_add_filter(bus, wait_filter, &d);
+ q = sd_bus_add_filter(bus, &slot, wait_filter, &d);
if (q < 0)
return log_oom();
@@ -2398,10 +2400,6 @@ static int wait_for_jobs(sd_bus *bus, Set *s) {
d.result = NULL;
}
- q = sd_bus_remove_filter(bus, wait_filter, &d);
- if (q < 0 && r == 0)
- r = q;
-
return r;
}