chiark / gitweb /
bus: minor fixes
authorLennart Poettering <lennart@poettering.net>
Tue, 14 May 2013 23:36:09 +0000 (01:36 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 14 May 2013 23:36:09 +0000 (01:36 +0200)
src/libsystemd-bus/bus-message.c
src/libsystemd-bus/bus-socket.c

index 5783140..721dafe 100644 (file)
@@ -3568,6 +3568,9 @@ int bus_message_seal(sd_bus_message *m, uint64_t serial) {
         if (m->n_containers > 0)
                 return -EBADMSG;
 
+        if (m->poisoned)
+                return -ESTALE;
+
         /* If there's a non-trivial signature set, then add it in here */
         if (!isempty(m->root_container.signature)) {
                 r = message_append_field_signature(m, SD_BUS_MESSAGE_HEADER_SIGNATURE, m->root_container.signature, NULL);
index 4dafe1f..4a07869 100644 (file)
@@ -72,7 +72,7 @@ static int append_iovec(sd_bus_message *m, const void *p, size_t sz) {
 
 static int bus_message_setup_iovec(sd_bus_message *m) {
         struct bus_body_part *part;
-        unsigned n;
+        unsigned n, i;
         int r;
 
         assert(m);
@@ -102,7 +102,7 @@ static int bus_message_setup_iovec(sd_bus_message *m) {
                         return r;
         }
 
-        for (part = &m->body; part && part->size > 0; part = part->next) {
+        for (i = 0, part = &m->body; i < m->n_body_parts; i++, part = part->next) {
                 r = append_iovec(m, part->data, part->size);
                 if (r < 0)
                         return r;