diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-05-15 01:43:15 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-05-15 01:43:15 +0200 |
commit | 9b29bb6853987bf6fef21531f69864fdfb39eb9a (patch) | |
tree | 85b58efc6f3b0955cad75df2f72069ab73e84341 /src/libsystemd-bus/bus-message.c | |
parent | 13c299d3a8603db8fdfc715eaea69ce5acd7aecb (diff) |
bus: add macro for iterating through body parts of a message
Diffstat (limited to 'src/libsystemd-bus/bus-message.c')
-rw-r--r-- | src/libsystemd-bus/bus-message.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c index 721dafe38b..3790102a75 100644 --- a/src/libsystemd-bus/bus-message.c +++ b/src/libsystemd-bus/bus-message.c @@ -3600,9 +3600,11 @@ int bus_message_seal(sd_bus_message *m, uint64_t serial) { m->header->fields_size -= a; } - for (i = 0, part = &m->body; i < m->n_body_parts; i++, part = part->next) - if (part->memfd >= 0 && part->sealed) + MESSAGE_FOREACH_PART(part, i, m) + if (part->memfd >= 0 && !part->sealed) { ioctl(part->memfd, KDBUS_CMD_MEMFD_SEAL_SET, 1); + part->sealed = true; + } m->header->serial = serial; m->sealed = true; @@ -3906,7 +3908,7 @@ int bus_message_get_blob(sd_bus_message *m, void **buffer, size_t *sz) { e = mempset(e, 0, 8 - (m->header->fields_size % 8)); } - for (i = 0, part = &m->body; i < m->n_body_parts; i++, part = part->next) + MESSAGE_FOREACH_PART(part, i, m) e = mempcpy(e, part->data, part->size); assert(total == (size_t) ((uint8_t*) e - (uint8_t*) p)); |