chiark / gitweb /
bus-slot: for bus slot objects with no explicit description use the match string...
authorLennart Poettering <lennart@poettering.net>
Wed, 30 May 2018 14:34:06 +0000 (16:34 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
Let's make debugging a but easier with implicit descriptions for some
match objects.

src/libelogind/sd-bus/bus-slot.c

index 3e592e3a2fbb1d0b8e2a5ca0c92302cd41c97d04..34cfdd29e9508aba8580b1bbe958bbc33bffc7ff 100644 (file)
@@ -300,8 +300,13 @@ _public_ int sd_bus_slot_set_description(sd_bus_slot *slot, const char *descript
 _public_ int sd_bus_slot_get_description(sd_bus_slot *slot, const char **description) {
         assert_return(slot, -EINVAL);
         assert_return(description, -EINVAL);
-        assert_return(slot->description, -ENXIO);
 
-        *description = slot->description;
+        if (slot->description)
+                *description = slot->description;
+        else if (slot->type == BUS_MATCH_CALLBACK)
+                *description = slot->match_callback.match_string;
+        else
+                return -ENXIO;
+
         return 0;
 }