summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
authorLukasz Skalski <l.skalski@partner.samsung.com>2013-12-02 16:31:46 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-02 17:35:06 +0100
commita009c158b098e961fd71db47a31ca15048c9816e (patch)
tree42af09d3fa17076932b8200fc8b8ddee88178fd1 /src/libsystemd-bus
parent006a0b8788681809a896544c1af68b5e79cce121 (diff)
Display synthetic message serial number in a more readable format than (uint32_t) -1
Serial=4294967295 field in message dump generated by bus_message_dump() function for synthetic messages isn't good readable.
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/bus-dump.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libsystemd-bus/bus-dump.c b/src/libsystemd-bus/bus-dump.c
index 469f7baaf5..71de081649 100644
--- a/src/libsystemd-bus/bus-dump.c
+++ b/src/libsystemd-bus/bus-dump.c
@@ -56,15 +56,21 @@ int bus_message_dump(sd_bus_message *m, FILE *f, bool with_header) {
if (with_header) {
fprintf(f,
- "%s%s%sType=%s%s%s Endian=%c Flags=%u Version=%u Serial=%u ",
+ "%s%s%sType=%s%s%s Endian=%c Flags=%u Version=%u",
m->header->type == SD_BUS_MESSAGE_METHOD_ERROR ? ansi_highlight_red() :
m->header->type == SD_BUS_MESSAGE_METHOD_RETURN ? ansi_highlight_green() :
m->header->type != SD_BUS_MESSAGE_SIGNAL ? ansi_highlight() : "", draw_special_char(DRAW_TRIANGULAR_BULLET), ansi_highlight_off(),
ansi_highlight(), bus_message_type_to_string(m->header->type), ansi_highlight_off(),
m->header->endian,
m->header->flags,
- m->header->version,
- BUS_MESSAGE_SERIAL(m));
+ m->header->version);
+
+ /* Display synthetic message serial number in a more readable
+ * format than (uint32_t) -1 */
+ if (BUS_MESSAGE_SERIAL(m) == 0xFFFFFFFFULL)
+ fprintf(f, " Serial=-1");
+ else
+ fprintf(f, " Serial=%u", BUS_MESSAGE_SERIAL(m));
if (m->reply_serial != 0)
fprintf(f, " ReplySerial=%u", m->reply_serial);