summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-02-17 18:03:50 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2015-02-17 18:16:07 +0100
commit4d2b1e0a3f98d8cf93beb943b05868b55231006a (patch)
treee6e55e6622e25751016fac4fc56a393335bf37c5 /src/libsystemd
parent484122c3458ae5ff5236dd4a6e6ddffcffa08336 (diff)
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.
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-bus/test-bus-zero-copy.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libsystemd/sd-bus/test-bus-zero-copy.c b/src/libsystemd/sd-bus/test-bus-zero-copy.c
index a054f74bf3..4ea9f9fc35 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");