summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-message.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-05-16 02:37:42 +0200
committerLennart Poettering <lennart@poettering.net>2013-05-16 02:37:42 +0200
commit1307c3ff9aa9d96fff6f9f42bb760887fa9aa240 (patch)
treef8d937aa4b454af00628e1c6c008df996e0bb28f /src/libsystemd-bus/bus-message.c
parenta392d36195f92eaa2d5b7c1d588ff8e52025a43a (diff)
bus: implement receiving side of memfd hookup
Diffstat (limited to 'src/libsystemd-bus/bus-message.c')
-rw-r--r--src/libsystemd-bus/bus-message.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index b5a311530b..209fd71c13 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -2196,6 +2196,13 @@ int bus_body_part_map(struct bus_body_part *part) {
if (part->size <= 0)
return 0;
+ /* For smaller zero parts (as used for padding) we don't need to map anything... */
+ if (part->memfd < 0 && part->is_zero && part->size < 8) {
+ static const uint8_t zeroes[7] = { };
+ part->data = (void*) zeroes;
+ return 0;
+ }
+
psz = PAGE_ALIGN(part->size);
if (part->memfd >= 0)
@@ -2222,9 +2229,6 @@ void bus_body_part_unmap(struct bus_body_part *part) {
if (part->memfd < 0)
return;
- if (!part->sealed)
- return;
-
if (!part->data)
return;