From 7e583e8891e531a9a8ecbbaa7d50fa4dd8bb45c7 Mon Sep 17 00:00:00 2001 From: Chan-yeol Park Date: Tue, 28 Aug 2012 19:24:54 +0900 Subject: [PATCH] core: replace NULL by dbus invalid arguments This patch replaces NULL with dbus invalid arguments return if dbus method call gets invalid arguments from the peer. This will avoid dbus peer coommander's infinite wait. --- audio/media.c | 4 ++-- audio/transport.c | 4 ++-- plugins/service.c | 8 ++++---- profiles/network/connection.c | 2 +- profiles/network/server.c | 4 ++-- src/adapter.c | 4 ++-- src/manager.c | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/audio/media.c b/audio/media.c index ea6d58263..b0ea4e97e 100644 --- a/audio/media.c +++ b/audio/media.c @@ -926,7 +926,7 @@ static DBusMessage *unregister_endpoint(DBusConnection *conn, DBusMessage *msg, if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) - return NULL; + return btd_error_invalid_args(msg); sender = dbus_message_get_sender(msg); @@ -1808,7 +1808,7 @@ static DBusMessage *unregister_player(DBusConnection *conn, DBusMessage *msg, if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) - return NULL; + return btd_error_invalid_args(msg); sender = dbus_message_get_sender(msg); diff --git a/audio/transport.c b/audio/transport.c index 832ad2a62..d40c92d56 100644 --- a/audio/transport.c +++ b/audio/transport.c @@ -667,7 +667,7 @@ static DBusMessage *acquire(DBusConnection *conn, DBusMessage *msg, if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &accesstype, DBUS_TYPE_INVALID)) - return NULL; + return btd_error_invalid_args(msg); sender = dbus_message_get_sender(msg); @@ -704,7 +704,7 @@ static DBusMessage *release(DBusConnection *conn, DBusMessage *msg, if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &accesstype, DBUS_TYPE_INVALID)) - return NULL; + return btd_error_invalid_args(msg); sender = dbus_message_get_sender(msg); diff --git a/plugins/service.c b/plugins/service.c index 9f7bdb7f6..f16abe705 100644 --- a/plugins/service.c +++ b/plugins/service.c @@ -422,7 +422,7 @@ static DBusMessage *update_xml_record(DBusConnection *conn, DBUS_TYPE_UINT32, &handle, DBUS_TYPE_STRING, &record, DBUS_TYPE_INVALID) == FALSE) - return NULL; + return btd_error_invalid_args(msg); len = (record ? strlen(record) : 0); if (len == 0) @@ -475,7 +475,7 @@ static DBusMessage *add_service_record(DBusConnection *conn, if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &record, DBUS_TYPE_INVALID) == FALSE) - return NULL; + return btd_error_invalid_args(msg); sender = dbus_message_get_sender(msg); err = add_xml_record(conn, sender, serv_adapter, record, &handle); @@ -509,7 +509,7 @@ static DBusMessage *remove_service_record(DBusConnection *conn, if (dbus_message_get_args(msg, NULL, DBUS_TYPE_UINT32, &handle, DBUS_TYPE_INVALID) == FALSE) - return NULL; + return btd_error_invalid_args(msg); sender = dbus_message_get_sender(msg); @@ -582,7 +582,7 @@ static DBusMessage *request_authorization(DBusConnection *conn, if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &address, DBUS_TYPE_UINT32, &handle, DBUS_TYPE_INVALID) == FALSE) - return NULL; + return btd_error_invalid_args(msg); sender = dbus_message_get_sender(msg); if (find_pending_by_sender(serv_adapter, sender)) diff --git a/profiles/network/connection.c b/profiles/network/connection.c index dba448e80..ca6d362a1 100644 --- a/profiles/network/connection.c +++ b/profiles/network/connection.c @@ -403,7 +403,7 @@ static DBusMessage *connection_connect(DBusConnection *conn, if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &svc, DBUS_TYPE_INVALID) == FALSE) - return NULL; + return btd_error_invalid_args(msg); id = bnep_service_id(svc); nc = find_connection(peer->connections, id); diff --git a/profiles/network/server.c b/profiles/network/server.c index ae8bd3685..903fa4f3b 100644 --- a/profiles/network/server.c +++ b/profiles/network/server.c @@ -633,7 +633,7 @@ static DBusMessage *register_server(DBusConnection *conn, if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &uuid, DBUS_TYPE_STRING, &bridge, DBUS_TYPE_INVALID)) - return NULL; + return btd_error_invalid_args(msg); if (g_strcmp0(uuid, "nap")) return btd_error_failed(msg, "Invalid UUID"); @@ -668,7 +668,7 @@ static DBusMessage *unregister_server(DBusConnection *conn, if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &uuid, DBUS_TYPE_INVALID)) - return NULL; + return btd_error_invalid_args(msg); if (g_strcmp0(uuid, "nap")) return btd_error_failed(msg, "Invalid UUID"); diff --git a/src/adapter.c b/src/adapter.c index 31fa87dae..f507aa508 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -1576,7 +1576,7 @@ static DBusMessage *register_agent(DBusConnection *conn, DBusMessage *msg, if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_STRING, &capability, DBUS_TYPE_INVALID)) - return NULL; + return btd_error_invalid_args(msg); if (adapter->agent) return btd_error_already_exists(msg); @@ -1606,7 +1606,7 @@ static DBusMessage *unregister_agent(DBusConnection *conn, DBusMessage *msg, if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) - return NULL; + return btd_error_invalid_args(msg); name = dbus_message_get_sender(msg); diff --git a/src/manager.c b/src/manager.c index 4a3946134..738bf0b58 100644 --- a/src/manager.c +++ b/src/manager.c @@ -96,7 +96,7 @@ static DBusMessage *find_adapter(DBusConnection *conn, if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &pattern, DBUS_TYPE_INVALID)) - return NULL; + return btd_error_invalid_args(msg); /* hci_devid() would make sense to use here, except it is * restricted to devices which are up */ -- 2.47.3