chiark / gitweb /
bus: dbus-daemons' access messages are a bit too verbose
authorLennart Poettering <lennart@poettering.net>
Mon, 4 Nov 2013 23:49:19 +0000 (00:49 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 5 Nov 2013 00:13:05 +0000 (01:13 +0100)
src/libsystemd-bus/bus-error.c

index c347b10..35e2614 100644 (file)
@@ -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);
 }