diff options
Diffstat (limited to 'src/libsystemd-bus/bus-error.c')
-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); } |