summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/test-bus-chat.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/test-bus-chat.c
parented205a6bc53735392b46fde6820520a1d18d6ebd (diff)
bus: also finish connection before returning from sd_bus_get_unique_name()
Diffstat (limited to 'src/libsystemd-bus/test-bus-chat.c')
-rw-r--r--src/libsystemd-bus/test-bus-chat.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libsystemd-bus/test-bus-chat.c b/src/libsystemd-bus/test-bus-chat.c
index 5f533cc6d0..24a194327e 100644
--- a/src/libsystemd-bus/test-bus-chat.c
+++ b/src/libsystemd-bus/test-bus-chat.c
@@ -35,6 +35,7 @@ static int server_init(sd_bus **_bus) {
sd_bus *bus = NULL;
sd_id128_t id;
int r;
+ const char *unique;
assert(_bus);
@@ -50,9 +51,15 @@ static int server_init(sd_bus **_bus) {
goto fail;
}
+ r = sd_bus_get_unique_name(bus, &unique);
+ if (r < 0) {
+ log_error("Failed to get unique name: %s", strerror(-r));
+ goto fail;
+ }
+
log_info("Peer ID is " SD_ID128_FORMAT_STR ".", SD_ID128_FORMAT_VAL(id));
+ log_info("Unique ID: %s", unique);
log_info("Can send file handles: %i", sd_bus_can_send(bus, 'h'));
- log_info("Unique ID: %s", strna(sd_bus_get_unique_name(bus)));
r = sd_bus_request_name(bus, "org.freedesktop.systemd.test", 0);
if (r < 0) {