diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-05-15 02:56:45 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-05-15 02:56:45 +0200 |
commit | c91cb83c4dbc9a95a0a2a38e7028e0a7f4af3b35 (patch) | |
tree | 5bf44548260b437f5dc62549cc5a2ce33166dd20 /src/libsystemd-bus/bus-socket.c | |
parent | 9b29bb6853987bf6fef21531f69864fdfb39eb9a (diff) |
bus: rework message struct to keep header with fields in same malloc() block
This allows us to guarantee that the first payload_vec we pass to the
kernel for each message is guaranteed to include the full header and all
its field.
Diffstat (limited to 'src/libsystemd-bus/bus-socket.c')
-rw-r--r-- | src/libsystemd-bus/bus-socket.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/libsystemd-bus/bus-socket.c b/src/libsystemd-bus/bus-socket.c index f43b7da05c..4635da4b9e 100644 --- a/src/libsystemd-bus/bus-socket.c +++ b/src/libsystemd-bus/bus-socket.c @@ -83,7 +83,7 @@ static int bus_message_setup_iovec(sd_bus_message *m) { assert(!m->iovec); - n = 1 + !!m->fields + m->n_body_parts; + n = 1 + m->n_body_parts; if (n < ELEMENTSOF(m->iovec_fixed)) m->iovec = m->iovec_fixed; else { @@ -92,16 +92,10 @@ static int bus_message_setup_iovec(sd_bus_message *m) { return -ENOMEM; } - r = append_iovec(m, m->header, sizeof(*m->header)); + r = append_iovec(m, m->header, BUS_MESSAGE_BODY_BEGIN(m)); if (r < 0) return r; - if (m->fields) { - r = append_iovec(m, m->fields, ALIGN8(m->header->fields_size)); - if (r < 0) - return r; - } - MESSAGE_FOREACH_PART(part, i, m) { r = append_iovec(m, part->data, part->size); if (r < 0) |