diff options
author | Simon Peeters <peeters.simon@gmail.com> | 2013-11-07 08:58:22 +0100 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2013-11-07 14:18:35 +0100 |
commit | 27e72d6b22890ba4a8cbc05c49667cd1cccf1461 (patch) | |
tree | d27783aebfae0c243fead854205aaae3cefa3537 /src/libsystemd-bus/bus-util.c | |
parent | 8be28fb1e0aa57b2a6ba7736440c9bba54cb86d1 (diff) |
bus: make bus_print_all_properties work for non machinectl cases
add a destination parameter and skip properties we can't read
Diffstat (limited to 'src/libsystemd-bus/bus-util.c')
-rw-r--r-- | src/libsystemd-bus/bus-util.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/libsystemd-bus/bus-util.c b/src/libsystemd-bus/bus-util.c index 13ad4442ba..bf8fb40905 100644 --- a/src/libsystemd-bus/bus-util.c +++ b/src/libsystemd-bus/bus-util.c @@ -628,7 +628,7 @@ int bus_print_property(const char *name, sd_bus_message *property, bool all) { return 0; } -int bus_print_all_properties(sd_bus *bus, const char *path, char **filter, bool all) { +int bus_print_all_properties(sd_bus *bus, const char *dest, const char *path, char **filter, bool all) { _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; int r; @@ -637,7 +637,7 @@ int bus_print_all_properties(sd_bus *bus, const char *path, char **filter, bool assert(path); r = sd_bus_call_method(bus, - "org.freedesktop.machine1", + dest, path, "org.freedesktop.DBus.Properties", "GetAll", @@ -671,8 +671,14 @@ int bus_print_all_properties(sd_bus *bus, const char *path, char **filter, bool r = bus_print_property(name, reply, all); if (r < 0) return r; - if (r == 0 && all) - printf("%s=[unprintable]\n", name); + if (r == 0) { + if (all) + printf("%s=[unprintable]\n", name); + /* skip what we didn't read */ + r = sd_bus_message_skip(reply, contents); + if (r < 0) + return r; + } r = sd_bus_message_exit_container(reply); if (r < 0) @@ -866,7 +872,7 @@ int bus_map_all_properties(sd_bus *bus, return r; v = (uint8_t *)userdata + prop->offset; - if (map[i].set) + if (map[i].set) r = prop->set(bus, member, m, &error, v); else r = map_basic(bus, member, m, &error, v); |