summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/test-bus-memfd.c
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2013-05-10 19:58:05 +0200
committerKay Sievers <kay@vrfy.org>2013-05-10 19:58:05 +0200
commit13019ef5ea284b03a74f25897a49fa5670974568 (patch)
tree334d194eac57103634d7abc0a15b540c0358ae46 /src/libsystemd-bus/test-bus-memfd.c
parent0d1b9a964746336bc7e493ee82ad6cf1bdf49dbb (diff)
bus: fix test-bus-memfd
Diffstat (limited to 'src/libsystemd-bus/test-bus-memfd.c')
-rw-r--r--src/libsystemd-bus/test-bus-memfd.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/libsystemd-bus/test-bus-memfd.c b/src/libsystemd-bus/test-bus-memfd.c
index 4b22ea9a68..37e150a397 100644
--- a/src/libsystemd-bus/test-bus-memfd.c
+++ b/src/libsystemd-bus/test-bus-memfd.c
@@ -40,32 +40,22 @@ int main(int argc, char *argv[]) {
if (r == -ENOENT)
return EXIT_TEST_SKIP;
- r = sd_memfd_map(m, 0, 6, (void**) &s);
+ r = sd_memfd_map(m, 0, 12, (void**) &s);
assert_se(r >= 0);
- strcpy(s, "hallo");
+ strcpy(s, "----- world");
r = sd_memfd_set_sealed(m, 1);
assert_se(r == -EPERM);
assert_se(write(sd_memfd_get_fd(m), "he", 2) == 2);
- assert_se(write(sd_memfd_get_fd(m), "HE", 2) == 2);
-
- log_error("lseek = %llu", (unsigned long long) lseek(sd_memfd_get_fd(m), 0, SEEK_CUR));
-
- log_info("<%s>", s);
-
- access("HUHU", F_OK);
+ assert_se(write(sd_memfd_get_fd(m), "ll", 2) == 2);
assert_se(sd_memfd_get_file(m, &f) >= 0);
- fputc('L', f);
+ fputc('o', f);
fflush(f);
- access("HAHA", F_OK);
-
- log_info("<%s>", s);
-
- assert_se(munmap(s, 6) == 0);
+ assert_se(munmap(s, 12) == 0);
r = sd_memfd_get_sealed(m);
assert_se(r == 0);
@@ -74,7 +64,7 @@ int main(int argc, char *argv[]) {
assert_se(r >= 0);
assert_se(sz = page_size());
- r = sd_memfd_set_size(m, 6);
+ r = sd_memfd_set_size(m, 12);
assert_se(r >= 0);
r = sd_memfd_set_sealed(m, 1);
@@ -93,9 +83,9 @@ int main(int argc, char *argv[]) {
r = sd_memfd_get_size(m, &sz);
assert_se(r >= 0);
- assert_se(sz = 6);
+ assert_se(sz = 12);
- r = sd_memfd_map(m, 0, 6, (void**) &s);
+ r = sd_memfd_map(m, 0, 12, (void**) &s);
assert_se(r >= 0);
r = sd_memfd_set_sealed(m, 1);
@@ -104,10 +94,8 @@ int main(int argc, char *argv[]) {
r = sd_memfd_set_sealed(m, 0);
assert_se(r == -EPERM);
- log_info("<%s>", s);
-
- assert_se(streq(s, "heLlo"));
- assert_se(munmap(s, 6) == 0);
+ assert_se(streq(s, "hello world"));
+ assert_se(munmap(s, 12) == 0);
r = sd_memfd_set_sealed(m, 0);
assert_se(r >= 0);