From 3fc047f43cd4e4a7cc6e7e49e12f1e2fd858b815 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 29 Oct 2013 21:37:32 +0100 Subject: bus: make bus message dump output a bit smaller --- src/libsystemd-bus/bus-message.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/libsystemd-bus') 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; -- cgit v1.2.3-54-g00ecf