summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2020-04-24 01:32:43 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2020-04-24 10:20:54 -0700
commit3aa815a31017e8793b030b04ef704ce85455b9aa (patch)
treea3d722c68b632db00e7ad9fad898f790b6c6002c /src
parentf0b7c11ad7b2240738f0ab99c258954cbe00dc77 (diff)
downloadbluez-3aa815a31017e8793b030b04ef704ce85455b9aa.tar.gz
device: Return error when ConnectProfile DBus method fails
Without this patch ConnectProfile DBus method does not return failure if profile connection failed and some other profile was already connected. This is not correct behavior as ConnectProfile DBus method should always return error when specified profile failed to connect. This patch fixes this it.
Diffstat (limited to 'src')
-rw-r--r--src/device.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/device.c b/src/device.c
index a8d95346a..c2de7b3b9 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1626,15 +1626,19 @@ done:
if (!dev->connect)
return;
- if (!err && dbus_message_is_method_call(dev->connect, DEVICE_INTERFACE,
- "Connect"))
- dev->general_connect = TRUE;
+ if (dbus_message_is_method_call(dev->connect, DEVICE_INTERFACE,
+ "Connect")) {
+ if (!err)
+ dev->general_connect = TRUE;
+ else if (!find_service_with_state(dev->services,
+ BTD_SERVICE_STATE_CONNECTED))
+ /* Reset error if there are services connected */
+ err = 0;
+ }
DBG("returning response to %s", dbus_message_get_sender(dev->connect));
- l = find_service_with_state(dev->services, BTD_SERVICE_STATE_CONNECTED);
-
- if (err && l == NULL) {
+ if (err) {
/* Fallback to LE bearer if supported */
if (err == -EHOSTDOWN && dev->le && !dev->le_state.connected) {
err = device_connect_le(dev);