summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/test-bus-marshal.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-marshal.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-marshal.c')
-rw-r--r--src/libsystemd/sd-bus/test-bus-marshal.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libsystemd/sd-bus/test-bus-marshal.c b/src/libsystemd/sd-bus/test-bus-marshal.c
index 2be4de571e..9532112524 100644
--- a/src/libsystemd/sd-bus/test-bus-marshal.c
+++ b/src/libsystemd/sd-bus/test-bus-marshal.c
@@ -93,8 +93,13 @@ int main(int argc, char *argv[]) {
_cleanup_free_ char *first = NULL, *second = NULL, *third = NULL;
_cleanup_fclose_ FILE *ms = NULL;
size_t first_size = 0, second_size = 0, third_size = 0;
+ _cleanup_bus_unref_ sd_bus *bus = NULL;
- r = sd_bus_message_new_method_call(NULL, &m, "foobar.waldo", "/", "foobar.waldo", "Piep");
+ r = sd_bus_default_system(&bus);
+ if (r < 0)
+ return EXIT_TEST_SKIP;
+
+ r = sd_bus_message_new_method_call(bus, &m, "foobar.waldo", "/", "foobar.waldo", "Piep");
assert_se(r >= 0);
r = sd_bus_message_append(m, "");
@@ -193,7 +198,7 @@ int main(int argc, char *argv[]) {
m = sd_bus_message_unref(m);
- r = bus_message_from_malloc(NULL, buffer, sz, NULL, 0, NULL, NULL, &m);
+ r = bus_message_from_malloc(bus, buffer, sz, NULL, 0, NULL, NULL, &m);
assert_se(r >= 0);
bus_message_dump(m, stdout, true);
@@ -266,7 +271,7 @@ int main(int argc, char *argv[]) {
r = sd_bus_message_peek_type(m, NULL, NULL);
assert_se(r == 0);
- r = sd_bus_message_new_method_call(NULL, &copy, "foobar.waldo", "/", "foobar.waldo", "Piep");
+ r = sd_bus_message_new_method_call(bus, &copy, "foobar.waldo", "/", "foobar.waldo", "Piep");
assert_se(r >= 0);
r = sd_bus_message_rewind(m, true);