daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
4bff0a
From 625795e6214ae7c7f0f7f35b2c1f53e1e173b1ad Mon Sep 17 00:00:00 2001
4bff0a
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
4bff0a
Date: Thu, 2 Aug 2018 00:46:20 +0200
4bff0a
Subject: [PATCH] bus: do not print (null) if the message has unknown type
4bff0a
4bff0a
(cherry picked from commit e8fd7e4b5b5269377efc641a7da43850822c1250)
4bff0a
4bff0a
Resolves: #1696224
4bff0a
---
4bff0a
 src/libsystemd/sd-bus/bus-dump.c | 10 ++++++++--
4bff0a
 1 file changed, 8 insertions(+), 2 deletions(-)
4bff0a
4bff0a
diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c
4bff0a
index 3a28c7c6e3..2bd06053a6 100644
4bff0a
--- a/src/libsystemd/sd-bus/bus-dump.c
4bff0a
+++ b/src/libsystemd/sd-bus/bus-dump.c
4bff0a
@@ -59,8 +59,14 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
4bff0a
                         "%s%s%s Type=%s%s%s  Endian=%c  Flags=%u  Version=%u  Priority=%"PRIi64,
4bff0a
                         m->header->type == SD_BUS_MESSAGE_METHOD_ERROR ? ansi_highlight_red() :
4bff0a
                         m->header->type == SD_BUS_MESSAGE_METHOD_RETURN ? ansi_highlight_green() :
4bff0a
-                        m->header->type != SD_BUS_MESSAGE_SIGNAL ? ansi_highlight() : "", special_glyph(TRIANGULAR_BULLET), ansi_normal(),
4bff0a
-                        ansi_highlight(), bus_message_type_to_string(m->header->type), ansi_normal(),
4bff0a
+                        m->header->type != SD_BUS_MESSAGE_SIGNAL ? ansi_highlight() : "",
4bff0a
+                        special_glyph(TRIANGULAR_BULLET),
4bff0a
+                        ansi_normal(),
4bff0a
+
4bff0a
+                        ansi_highlight(),
4bff0a
+                        bus_message_type_to_string(m->header->type) ?: "(unknown)",
4bff0a
+                        ansi_normal(),
4bff0a
+
4bff0a
                         m->header->endian,
4bff0a
                         m->header->flags,
4bff0a
                         m->header->version,