diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-10-30 18:28:37 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-10-30 18:28:37 +0100 |
commit | 73843b52585d42cc1a970a1c664818ece6942e9e (patch) | |
tree | 471c50000670cf5064973929dd864b9601b1dc4d /src/libsystemd/sd-bus/bus-kernel.c | |
parent | 47f0f4eb1d79ec37dfbe6a382817c0384b106373 (diff) |
memfd: always use our internal utility functions where we have them
Diffstat (limited to 'src/libsystemd/sd-bus/bus-kernel.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-kernel.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index 3f8b0ab65a..6692d9b7f5 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -1118,20 +1118,13 @@ int bus_kernel_pop_memfd(sd_bus *bus, void **address, size_t *mapped, size_t *al assert_se(pthread_mutex_lock(&bus->memfd_cache_mutex) >= 0); if (bus->n_memfd_cache <= 0) { - _cleanup_free_ char *g = NULL; int r; assert_se(pthread_mutex_unlock(&bus->memfd_cache_mutex) >= 0); - assert(bus->connection_name); - - g = bus_label_escape(bus->connection_name); - if (!g) - return -ENOMEM; - - r = memfd_create(g, MFD_ALLOW_SEALING|MFD_CLOEXEC); + r = memfd_new(bus->connection_name); if (r < 0) - return -errno; + return r; *address = NULL; *mapped = 0; @@ -1188,7 +1181,7 @@ void bus_kernel_push_memfd(sd_bus *bus, int fd, void *address, size_t mapped, si /* If overly long, let's return a bit to the OS */ if (mapped > max_mapped) { - assert_se(ftruncate(fd, max_mapped) >= 0); + assert_se(memfd_set_size(fd, max_mapped) >= 0); assert_se(munmap((uint8_t*) address + max_mapped, PAGE_ALIGN(mapped - max_mapped)) >= 0); c->mapped = c->allocated = max_mapped; } else { |