From 201e419aea8d9c6170091e1e4eefa6999e7d3e0b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 7 Feb 2018 22:28:42 +0100 Subject: [PATCH] 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. --- src/libsystemd/sd-bus/sd-bus.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; } -- 2.47.3