diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-12-21 03:17:29 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-12-21 03:46:20 +0100 |
commit | 8e8d37602f33269df0b0d3d93f017d7263b5cea0 (patch) | |
tree | 69c6d4f32994ec2626411dee8bea93c6a69902eb /src/libsystemd-bus | |
parent | 253ce82b643569564ca8f5730e728f41fcf23d08 (diff) |
bus: always override message destination field with data from kdbus
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r-- | src/libsystemd-bus/bus-kernel.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c index 5913d42346..e53bc51727 100644 --- a/src/libsystemd-bus/bus-kernel.c +++ b/src/libsystemd-bus/bus-kernel.c @@ -848,14 +848,15 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) { m->sender = m->creds.unique_name = m->sender_buffer; } - if (!m->destination) { - if (destination) - m->destination = destination; - else if (k->dst_id != KDBUS_DST_ID_NAME && - k->dst_id != KDBUS_DST_ID_BROADCAST) { - snprintf(m->destination_buffer, sizeof(m->destination_buffer), ":1.%llu", (unsigned long long) k->dst_id); - m->destination = m->destination_buffer; - } + if (destination) + m->destination = destination; + else if (k->dst_id == KDBUS_DST_ID_BROADCAST) + m->destination = NULL; + else if (k->dst_id == KDBUS_DST_ID_NAME) + m->destination = bus->unique_name; /* fill in unique name if the well-known name is missing */ + else { + snprintf(m->destination_buffer, sizeof(m->destination_buffer), ":1.%llu", (unsigned long long) k->dst_id); + m->destination = m->destination_buffer; } /* We take possession of the kmsg struct now */ |