diff options
Diffstat (limited to 'src/libsystemd-bus/bus-control.c')
-rw-r--r-- | src/libsystemd-bus/bus-control.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libsystemd-bus/bus-control.c b/src/libsystemd-bus/bus-control.c index 9d242dc413..06afaf3c76 100644 --- a/src/libsystemd-bus/bus-control.c +++ b/src/libsystemd-bus/bus-control.c @@ -28,11 +28,20 @@ #include "bus-internal.h" #include "bus-message.h" -const char *sd_bus_get_unique_name(sd_bus *bus) { +int sd_bus_get_unique_name(sd_bus *bus, const char **unique) { + int r; + if (!bus) - return NULL; + return -EINVAL; + if (!unique) + return -EINVAL; - return bus->unique_name; + r = bus_ensure_running(bus); + if (r < 0) + return r; + + *unique = bus->unique_name; + return 0; } int sd_bus_request_name(sd_bus *bus, const char *name, int flags) { |