From aea93debfa1281a7d5f1523225b043955c1c2472 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 19 Nov 2013 01:21:27 +0100 Subject: [PATCH] bus: bump serial number counter when sending already sealed messages --- src/libsystemd-bus/sd-bus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c index d93138bb152..0be5a29f367 100644 --- a/src/libsystemd-bus/sd-bus.c +++ b/src/libsystemd-bus/sd-bus.c @@ -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); }