1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 16:21:26 +03:00

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.
This commit is contained in:
Lennart Poettering 2018-02-07 22:28:42 +01:00
parent 96cc44539b
commit 201e419aea

View 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->description, -ENXIO);
assert_return(!bus_pid_changed(bus), -ECHILD); 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; return 0;
} }