summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/test-bus-gvariant.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-06-06 18:30:01 +0200
committerLennart Poettering <lennart@poettering.net>2014-06-06 18:30:01 +0200
commit2a0958d2d011b2debdb266144754bb5cdc4da65d (patch)
treeaaf8733e5299e0e4700d0427e4277be72a82f73c /src/libsystemd/sd-bus/test-bus-gvariant.c
parent55152b6ede680b9ac947c49d7dfa31cd3abe594e (diff)
sd-bus: don't allow creating message objects that are not attached to a bus
It seems unnecessary to support this, and we rather should avoid allowing this at all, so that people don't program against this sloppily and we end up remarshalling all the time...
Diffstat (limited to 'src/libsystemd/sd-bus/test-bus-gvariant.c')
-rw-r--r--src/libsystemd/sd-bus/test-bus-gvariant.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/test-bus-gvariant.c b/src/libsystemd/sd-bus/test-bus-gvariant.c
index f2c1fc1257..9226858825 100644
--- a/src/libsystemd/sd-bus/test-bus-gvariant.c
+++ b/src/libsystemd/sd-bus/test-bus-gvariant.c
@@ -134,8 +134,12 @@ static void test_marshal(void) {
_cleanup_bus_unref_ sd_bus *bus = NULL;
_cleanup_free_ void *blob;
size_t sz;
+ int r;
+
+ r = sd_bus_open_system(&bus);
+ if (r < 0)
+ exit(EXIT_TEST_SKIP);
- assert_se(sd_bus_open_system(&bus) >= 0);
bus->message_version = 2; /* dirty hack to enable gvariant*/
assert_se(sd_bus_message_new_method_call(bus, &m, "a.service.name", "/an/object/path/which/is/really/really/long/so/that/we/hit/the/eight/bit/boundary/by/quite/some/margin/to/test/this/stuff/that/it/really/works", "an.interface.name", "AMethodName") >= 0);
@@ -175,7 +179,7 @@ static void test_marshal(void) {
assert_se(bus_message_get_blob(m, &blob, &sz) >= 0);
- assert_se(bus_message_from_malloc(NULL, blob, sz, NULL, 0, NULL, NULL, &n) >= 0);
+ assert_se(bus_message_from_malloc(bus, blob, sz, NULL, 0, NULL, NULL, &n) >= 0);
blob = NULL;
assert_se(bus_message_dump(n, NULL, true) >= 0);