diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-12-23 17:30:21 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-12-23 17:30:21 +0100 |
commit | 46525bfc020e06609a44670f277aaf23954e7d85 (patch) | |
tree | f2bf2d0d1a656100e48fcbf8f336b7a39455e34d | |
parent | dc74ce9b4a49ab31383d00b30406bc225b2cc8ed (diff) |
bus: make sure sd_bus_emit_properties_changed_strv() doesn't return ENOENT if no properties with a change flag are in the interface
-rw-r--r-- | src/libsystemd-bus/bus-objects.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libsystemd-bus/bus-objects.c b/src/libsystemd-bus/bus-objects.c index 30f6124b99..b116a5dd10 100644 --- a/src/libsystemd-bus/bus-objects.c +++ b/src/libsystemd-bus/bus-objects.c @@ -1981,6 +1981,7 @@ static int emit_properties_changed_on_interface( const char *path, const char *interface, bool require_fallback, + bool *found_interface, char **names) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; @@ -1997,6 +1998,7 @@ static int emit_properties_changed_on_interface( assert(prefix); assert(path); assert(interface); + assert(found_interface); n = hashmap_get(bus->nodes, prefix); if (!n) @@ -2032,6 +2034,8 @@ static int emit_properties_changed_on_interface( if (r == 0) continue; + *found_interface = true; + if (names) { /* If the caller specified a list of * properties we include exactly those in the @@ -2185,6 +2189,7 @@ _public_ int sd_bus_emit_properties_changed_strv( char **names) { BUS_DONT_DESTROY(bus); + bool found_interface = false; char *prefix; int r; @@ -2205,7 +2210,7 @@ _public_ int sd_bus_emit_properties_changed_strv( do { bus->nodes_modified = false; - r = emit_properties_changed_on_interface(bus, path, path, interface, false, names); + r = emit_properties_changed_on_interface(bus, path, path, interface, false, &found_interface, names); if (r != 0) return r; if (bus->nodes_modified) @@ -2213,7 +2218,7 @@ _public_ int sd_bus_emit_properties_changed_strv( prefix = alloca(strlen(path) + 1); OBJECT_PATH_FOREACH_PREFIX(prefix, path) { - r = emit_properties_changed_on_interface(bus, prefix, path, interface, true, names); + r = emit_properties_changed_on_interface(bus, prefix, path, interface, true, &found_interface, names); if (r != 0) return r; if (bus->nodes_modified) @@ -2222,7 +2227,7 @@ _public_ int sd_bus_emit_properties_changed_strv( } while (bus->nodes_modified); - return -ENOENT; + return found_interface ? 0 : -ENOENT; } _public_ int sd_bus_emit_properties_changed( |