]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-bus: synthesize a description for user/system bus if otherwise unset
authorLennart Poettering <lennart@poettering.net>
Wed, 7 Feb 2018 21:28:42 +0000 (22:28 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 12 Feb 2018 10:34:00 +0000 (11:34 +0100)
Let's make debugging easier, by synthesizing a name when we have some
indication what kind of bus this is.

src/libsystemd/sd-bus/sd-bus.c

index c69c596c59b998fd8143c7c3778d49f2bdcbe299..cbbc6b6f0cd512247a7106a52fafb8dbdd069776 100644 (file)
@@ -3920,7 +3920,15 @@ _public_ int sd_bus_get_description(sd_bus *bus, const char **description) {
         assert_return(bus->description, -ENXIO);
         assert_return(!bus_pid_changed(bus), -ECHILD);
 
-        *description = bus->description;
+        if (bus->description)
+                *description = bus->description;
+        else if (bus->is_system)
+                *description = "system";
+        else if (bus->is_user)
+                *description = "user";
+        else
+                *description = NULL;
+
         return 0;
 }