diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-05-16 16:26:35 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-05-16 16:26:35 +0200 |
commit | 66b26c5c9b02e787bc46db24daff04ad41e05ec5 (patch) | |
tree | 01d0699b9f2e8023458be5ac25333cbde99b9ed9 /src/libsystemd-bus/bus-socket.c | |
parent | 0a0c35d151570cca5ccd30befaa19c87b9c8c92d (diff) |
bus: send memfds as payload only on directed messages and for large parts
Diffstat (limited to 'src/libsystemd-bus/bus-socket.c')
-rw-r--r-- | src/libsystemd-bus/bus-socket.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/libsystemd-bus/bus-socket.c b/src/libsystemd-bus/bus-socket.c index 4635da4b9e..befded7079 100644 --- a/src/libsystemd-bus/bus-socket.c +++ b/src/libsystemd-bus/bus-socket.c @@ -88,23 +88,33 @@ static int bus_message_setup_iovec(sd_bus_message *m) { m->iovec = m->iovec_fixed; else { m->iovec = new(struct iovec, n); - if (!m->iovec) - return -ENOMEM; + if (!m->iovec) { + r = -ENOMEM; + goto fail; + } } r = append_iovec(m, m->header, BUS_MESSAGE_BODY_BEGIN(m)); if (r < 0) - return r; + goto fail; MESSAGE_FOREACH_PART(part, i, m) { + r = bus_body_part_map(part); + if (r < 0) + goto fail; + r = append_iovec(m, part->data, part->size); if (r < 0) - return r; + goto fail; } assert(n == m->n_iovec); return 0; + +fail: + m->poisoned = true; + return r; } bool bus_socket_auth_needs_write(sd_bus *b) { |