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

Lennart Poettering lennart at poettering.net
Wed Mar 9 18:03:26 PST 2011


On Wed, 09.03.11 13:25, Andrey Borzenkov (arvidjaar at gmail.com) wrote:

> 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

sysrtemd git now returns UnknownProperty in these cases, as this seems
to be thew new official error code for this.

> 
> 
> ---
>  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;


Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list