From: Lennart Poettering Date: Wed, 7 Feb 2018 21:28:42 +0000 (+0100) Subject: sd-bus: synthesize a description for user/system bus if otherwise unset X-Git-Tag: v238~101^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=201e419aea8d9c6170091e1e4eefa6999e7d3e0b;p=thirdparty%2Fsystemd.git sd-bus: synthesize a description for user/system bus if otherwise unset Let's make debugging easier, by synthesizing a name when we have some indication what kind of bus this is. --- diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index c69c596c59b..cbbc6b6f0cd 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -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; }