summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-message.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-10-30 18:28:37 +0100
committerLennart Poettering <lennart@poettering.net>2014-10-30 18:28:37 +0100
commit73843b52585d42cc1a970a1c664818ece6942e9e (patch)
tree471c50000670cf5064973929dd864b9601b1dc4d /src/libsystemd/sd-bus/bus-message.c
parent47f0f4eb1d79ec37dfbe6a382817c0384b106373 (diff)
memfd: always use our internal utility functions where we have them
Diffstat (limited to 'src/libsystemd/sd-bus/bus-message.c')
-rw-r--r--src/libsystemd/sd-bus/bus-message.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index 1362a60f08..0eea32b649 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -1097,10 +1097,10 @@ static int part_make_space(
uint64_t new_allocated;
new_allocated = PAGE_ALIGN(sz > 0 ? 2 * sz : 1);
- r = ftruncate(part->memfd, new_allocated);
+ r = memfd_set_size(part->memfd, new_allocated);
if (r < 0) {
m->poisoned = true;
- return -errno;
+ return r;
}
part->allocated = new_allocated;
@@ -2820,11 +2820,12 @@ int bus_message_seal(sd_bus_message *m, uint64_t cookie, usec_t timeout) {
/* Then, sync up real memfd size */
sz = part->size;
- if (ftruncate(part->memfd, sz) < 0)
- return -errno;
+ r = memfd_set_size(part->memfd, sz);
+ if (r < 0)
+ return r;
/* Finally, try to seal */
- if (fcntl(part->memfd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_WRITE) >= 0)
+ if (memfd_set_sealed(part->memfd) >= 0)
part->sealed = true;
}
}