diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-03-22 17:56:08 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-03-22 17:56:08 +0000 |
commit | 0f7f9e9d9fc5493258d2b64b6ae8085c07d177d9 (patch) | |
tree | 548bc3c000fefea2013268bb60ccef51b9df03b6 /network | |
parent | d1ffb661fd4fb9f81ba406345e4c17dadd766265 (diff) |
network: returning a better message content in the D-Bus error for invalid arguments
Diffstat (limited to 'network')
-rw-r--r-- | network/server.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/network/server.c b/network/server.c index 02ad8edf..5cfb332e 100644 --- a/network/server.c +++ b/network/server.c @@ -81,16 +81,21 @@ static DBusHandlerResult set_name(DBusConnection *conn, { struct network_server *ns = data; DBusMessage *reply; + DBusError derr; const char *name; reply = dbus_message_new_method_return(msg); if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; - if (!dbus_message_get_args(msg, NULL, + dbus_error_init(&derr); + if (!dbus_message_get_args(msg, &derr, DBUS_TYPE_STRING, &name, - DBUS_TYPE_INVALID)) - return err_invalid_args(conn, msg, "Invalid name"); + DBUS_TYPE_INVALID)) { + err_invalid_args(conn, msg, derr.message); + dbus_error_free(&derr); + return DBUS_HANDLER_RESULT_HANDLED; + } if (!name || (strlen(name) == 0)) return err_invalid_args(conn, msg, "Invalid name"); |