diff mbox series

[BlueZ,2/2] adapter: Return Busy error when setting is pending

Message ID 20210304222448.3769100-2-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,1/2] adapter: Fix not using the correct setting | expand

Commit Message

Luiz Augusto von Dentz March 4, 2021, 10:24 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This returns an error if application attempts to change a property that
is pending.

Fixes: https://github.com/bluez/bluez/issues/99
---
 src/adapter.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index f483cc827..cc0849f99 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2880,12 +2880,18 @@  static void property_set_mode(struct btd_adapter *adapter, uint32_t setting,
 
 	dbus_message_iter_get_basic(value, &enable);
 
+	if (adapter->pending_settings & setting) {
+		g_dbus_pending_property_error(id, ERROR_INTERFACE ".Busy",
+						NULL);
+		return;
+	}
+
 	if (adapter->current_settings & setting)
 		current_enable = TRUE;
 	else
 		current_enable = FALSE;
 
-	if (enable == current_enable || adapter->pending_settings & setting) {
+	if (enable == current_enable) {
 		g_dbus_pending_property_success(id);
 		return;
 	}