summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/test-bus-zero-copy.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-05-16 02:04:13 +0200
committerLennart Poettering <lennart@poettering.net>2013-05-16 02:04:13 +0200
commita392d36195f92eaa2d5b7c1d588ff8e52025a43a (patch)
tree9929c75af232b5ceb423091686457da76c803d81 /src/libsystemd-bus/test-bus-zero-copy.c
parent3f92e4b4b61042391bd44de4dceb18177df0dd57 (diff)
bus: put together messages with memfd payload correctly
Diffstat (limited to 'src/libsystemd-bus/test-bus-zero-copy.c')
-rw-r--r--src/libsystemd-bus/test-bus-zero-copy.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/libsystemd-bus/test-bus-zero-copy.c b/src/libsystemd-bus/test-bus-zero-copy.c
index 024a0bfddf..0d8435ec1e 100644
--- a/src/libsystemd-bus/test-bus-zero-copy.c
+++ b/src/libsystemd-bus/test-bus-zero-copy.c
@@ -38,6 +38,7 @@ int main(int argc, char *argv[]) {
int r, bus_ref;
sd_bus_message *m;
sd_memfd *f;
+ uint64_t sz;
log_set_max_level(LOG_DEBUG);
@@ -79,21 +80,27 @@ int main(int argc, char *argv[]) {
memset(p, 'L', 32);
- r = sd_memfd_new_and_map(&f, 32, &p);
+ r = sd_memfd_new_and_map(&f, 17, &p);
assert_se(r >= 0);
- memset(p, 'P', 32);
- munmap(p, 32);
+ memset(p, 'P', 17);
+ munmap(p, 17);
- r = sd_memfd_set_size(f, 32);
+ r = sd_memfd_get_size(f, &sz);
assert_se(r >= 0);
+ assert_se(sz == 17);
r = sd_bus_message_append_array_memfd(m, 'y', f);
assert_se(r >= 0);
+ sd_memfd_free(f);
+
r = sd_bus_message_close_container(m);
assert_se(r >= 0);
+ r = sd_bus_message_append(m, "u", 4711);
+ assert_se(r >= 0);
+
r = bus_message_seal(m, 55);
assert_se(r >= 0);
@@ -106,7 +113,6 @@ int main(int argc, char *argv[]) {
sd_bus_unref(a);
sd_bus_unref(b);
- sd_memfd_free(f);
return 0;
}