summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-09-21 21:41:55 +0200
committerGitHub <noreply@github.com>2017-09-21 21:41:55 +0200
commitd82611c9183604bcf2c2871c55b4250fcd4a7247 (patch)
treede064852e66bdf407e72b415c1daa735b7ec1667
parentLink to the right glibc commit in comment (#6884) (diff)
parentsd-bus: style nitpick node_vtable_get_userdata() (diff)
downloadsystemd-d82611c9183604bcf2c2871c55b4250fcd4a7247.tar.xz
systemd-d82611c9183604bcf2c2871c55b4250fcd4a7247.zip
Merge pull request #6853 from sourcejedi/GetAll
sd-bus: fix response for GetAll on non-existent objects
-rw-r--r--src/libsystemd/sd-bus/bus-objects.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
index bb06d302ca..dcd929b13b 100644
--- a/src/libsystemd/sd-bus/bus-objects.c
+++ b/src/libsystemd/sd-bus/bus-objects.c
@@ -38,7 +38,7 @@ static int node_vtable_get_userdata(
sd_bus_error *error) {
sd_bus_slot *s;
- void *u;
+ void *u, *found_u;
int r;
assert(bus);
@@ -50,7 +50,7 @@ static int node_vtable_get_userdata(
if (c->find) {
bus->current_slot = sd_bus_slot_ref(s);
bus->current_userdata = u;
- r = c->find(bus, path, c->interface, u, &u, error);
+ r = c->find(bus, path, c->interface, u, &found_u, error);
bus->current_userdata = NULL;
bus->current_slot = sd_bus_slot_unref(s);
@@ -60,10 +60,11 @@ static int node_vtable_get_userdata(
return -sd_bus_error_get_errno(error);
if (r == 0)
return r;
- }
+ } else
+ found_u = u;
if (userdata)
- *userdata = u;
+ *userdata = found_u;
return 1;
}
@@ -829,6 +830,9 @@ static int property_get_all_callbacks_run(
return 0;
}
+ if (!*found_object)
+ return 0;
+
if (!found_interface) {
r = sd_bus_reply_method_errorf(
m,