summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libsystemd-bus/bus-message.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 138d664f3c..bd0079dbb9 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -4047,8 +4047,6 @@ int bus_message_dump(sd_bus_message *m, FILE *f, bool with_header) {
"\tsender=%s\n"
"\tsignature=%s\n"
"\treply_serial=%u\n"
- "\terror.name=%s\n"
- "\terror.message=%s\n"
"\tsealed=%s\n"
"\tn_body_parts=%u\n",
m,
@@ -4067,11 +4065,16 @@ int bus_message_dump(sd_bus_message *m, FILE *f, bool with_header) {
strna(m->sender),
strna(m->root_container.signature),
m->reply_serial,
- strna(m->error.name),
- strna(m->error.message),
yes_no(m->sealed),
m->n_body_parts);
+ if (sd_bus_error_is_set(&m->error))
+ fprintf(f,
+ "\terror.name=%s\n"
+ "\terror.message=%s\n",
+ strna(m->error.name),
+ strna(m->error.message));
+
if (m->pid != 0)
fprintf(f, "\tpid=%lu\n", (unsigned long) m->pid);
if (m->tid != 0)
@@ -4113,7 +4116,9 @@ int bus_message_dump(sd_bus_message *m, FILE *f, bool with_header) {
if (sd_bus_message_get_audit_sessionid(m, &audit_sessionid) >= 0)
fprintf(f, "\taudit_sessionid=%lu\n", (unsigned long) audit_sessionid);
- fprintf(f, "\tCAP_KILL=%i\n", sd_bus_message_has_effective_cap(m, 5));
+ r = sd_bus_message_has_effective_cap(m, 5);
+ if (r >= 0)
+ fprintf(f, "\tCAP_KILL=%s\n", yes_no(r));
if (sd_bus_message_get_cmdline(m, &cmdline) >= 0) {
char **c;