chiark / gitweb /
bus: don't skip interfaces in bus_message_map_properties_changed()
authorDavid Herrmann <dh.herrmann@gmail.com>
Thu, 28 Aug 2014 13:24:00 +0000 (15:24 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Thu, 28 Aug 2014 13:25:51 +0000 (15:25 +0200)
Skipping interfaces randomly without the caller specifying it is nasty.
Avoid this and let the caller do that themselves.

src/libsystemd-terminal/idev-keyboard.c
src/libsystemd/sd-bus/bus-util.c

index 03f54bb..ab9e481 100644 (file)
@@ -317,11 +317,14 @@ static int kbdctx_locale_props_changed_fn(sd_bus *bus,
 
         kc->slot_locale_get_all = sd_bus_slot_unref(kc->slot_locale_get_all);
 
+        /* skip interface name */
+        r = sd_bus_message_skip(signal, "s");
+        if (r < 0)
+                goto error;
+
         r = bus_message_map_properties_changed(bus, signal, kbdctx_locale_map, kc);
-        if (r < 0) {
-                log_debug("idev-keyboard: cannot handle PropertiesChanged from locale1: %s", strerror(-r));
-                return r;
-        }
+        if (r < 0)
+                goto error;
 
         if (r > 0) {
                 r = kbdctx_query_locale(kc);
@@ -331,6 +334,10 @@ static int kbdctx_locale_props_changed_fn(sd_bus *bus,
 
         kbdctx_refresh_keymap(kc);
         return 0;
+
+error:
+        log_debug("idev-keyboard: cannot handle PropertiesChanged from locale1: %s", strerror(-r));
+        return r;
 }
 
 static int kbdctx_setup_bus(kbdctx *kc) {
index aed3889..a85d361 100644 (file)
@@ -1051,9 +1051,6 @@ int bus_message_map_properties_changed(sd_bus *bus,
         assert(m);
         assert(map);
 
-        /* skip interface, but allow callers to do that themselves */
-        sd_bus_message_skip(m, "s");
-
         r = bus_message_map_all_properties(bus, m, map, userdata);
         if (r < 0)
                 return r;