[systemd-devel] [PATCH] dbus: return InvalidArgs for unknown property

Andrey Borzenkov arvidjaar at gmail.com
Wed Mar 9 02:25:04 PST 2011


Currently it falls through to UnknownMethod which is rather misleading.

{pts/0}% dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.DBus.Properties.Get string:org.freedesktop.systemd1.Manager string:foo                                                 
Error org.freedesktop.DBus.Error.UnknownMethod: Method "Get" with signature "ss" on interface "org.freedesktop.DBus.Properties" doesn't exist


---
 src/dbus.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/dbus.c b/src/dbus.c
index 5a4750d..8bddb9a 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -1269,7 +1269,8 @@ DBusHandlerResult bus_default_message_handler(Manager *m, DBusConnection *c, DBu
 
                         if (!dbus_message_iter_close_container(&iter, &sub))
                                 goto oom;
-                }
+                } else
+                        return bus_send_error_reply(m, c, message, NULL, -EINVAL);
 
         } else if (dbus_message_is_method_call(message, "org.freedesktop.DBus.Properties", "GetAll") && properties) {
                 const char *interface;
-- 
tg: (1de4d79..) u/dbus-einval (depends on: origin/master)


More information about the systemd-devel mailing list