chiark / gitweb /
bus: bump serial number counter when sending already sealed messages
authorLennart Poettering <lennart@poettering.net>
Tue, 19 Nov 2013 00:21:27 +0000 (01:21 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 20 Nov 2013 18:36:14 +0000 (19:36 +0100)
src/libsystemd-bus/sd-bus.c

index d93138b..0be5a29 100644 (file)
@@ -1271,8 +1271,13 @@ static int bus_seal_message(sd_bus *b, sd_bus_message *m) {
         if (m->header->version > b->message_version)
                 return -EPERM;
 
-        if (m->sealed)
+        if (m->sealed) {
+                /* If we copy the same message to multiple
+                 * destinations, avoid using the same serial
+                 * numbers. */
+                b->serial = MAX(b->serial, BUS_MESSAGE_SERIAL(m));
                 return 0;
+        }
 
         return bus_message_seal(m, ++b->serial);
 }