From 4d2b1e0a3f98d8cf93beb943b05868b55231006a Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Tue, 17 Feb 2015 18:03:50 +0100 Subject: [PATCH] bus: don't rely on static IDs in tests We should never put any constraints on the IDs returned by the kernel. Use sd_bus_get_unique_name() to retrieve the ID of a peer. --- src/libsystemd/sd-bus/test-bus-zero-copy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libsystemd/sd-bus/test-bus-zero-copy.c b/src/libsystemd/sd-bus/test-bus-zero-copy.c index a054f74bf..4ea9f9fc3 100644 --- a/src/libsystemd/sd-bus/test-bus-zero-copy.c +++ b/src/libsystemd/sd-bus/test-bus-zero-copy.c @@ -39,6 +39,7 @@ int main(int argc, char *argv[]) { _cleanup_free_ char *name = NULL, *bus_name = NULL, *address = NULL; + const char *unique; uint8_t *p; sd_bus *a, *b; int r, bus_ref; @@ -81,7 +82,10 @@ int main(int argc, char *argv[]) { r = sd_bus_start(b); assert_se(r >= 0); - r = sd_bus_message_new_method_call(b, &m, ":1.1", "/a/path", "an.inter.face", "AMethod"); + r = sd_bus_get_unique_name(a, &unique); + assert_se(r >= 0); + + r = sd_bus_message_new_method_call(b, &m, unique, "/a/path", "an.inter.face", "AMethod"); assert_se(r >= 0); r = sd_bus_message_open_container(m, 'r', "aysay"); -- 2.30.2