diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-11-05 00:49:19 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-11-05 01:13:05 +0100 |
commit | c9b6cb28c35e18649575b82466d7d6eb29aa5196 (patch) | |
tree | 0d1166b03f74901bbe34fb28436ff0ba61af96d8 /src/libsystemd-bus | |
parent | 90e071d1d59be05fcba66561439c3ca67c80ee20 (diff) |
bus: dbus-daemons' access messages are a bit too verbose
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r-- | src/libsystemd-bus/bus-error.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libsystemd-bus/bus-error.c b/src/libsystemd-bus/bus-error.c index c347b101bc..35e2614640 100644 --- a/src/libsystemd-bus/bus-error.c +++ b/src/libsystemd-bus/bus-error.c @@ -448,11 +448,18 @@ int sd_bus_error_set_errnof(sd_bus_error *e, int error, const char *format, ...) const char *bus_error_message(const sd_bus_error *e, int error) { + if (e) { + /* Sometimes the D-Bus server is a little bit too verbose with + * its error messages, so let's override them here */ + if (sd_bus_error_has_name(e, SD_BUS_ERROR_ACCESS_DENIED)) + return "Access denied"; + + if (e->message) + return e->message; + } + if (error < 0) error = -error; - if (e && e->message) - return e->message; - return strerror(error); } |