summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-control.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-22 03:34:29 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-22 03:37:10 +0100
commit20902f3ec8b9d3f8949b15dbd961d3eeb37e9b7b (patch)
tree78e811b2743babd8c3d92412abe553d61e2e5b7a /src/libsystemd-bus/bus-control.c
parented205a6bc53735392b46fde6820520a1d18d6ebd (diff)
bus: also finish connection before returning from sd_bus_get_unique_name()
Diffstat (limited to 'src/libsystemd-bus/bus-control.c')
-rw-r--r--src/libsystemd-bus/bus-control.c15
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) {