From 20160ae61b1e7fce7397857eb54223b69ab511c8 Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Fri, 25 Jan 2013 11:30:59 -0300 Subject: [PATCH] adapter: Fix not removing a device when the adapter is down It is a documented error that MGMT_UNPAIR_DEVICE should return an error if the controller is not powered. This error is being ignored, and if the user asks for a device to be removed while the controller is powered down, the keys associated with that device will still be in the kernel side. The solution is to return the user an error when it is asked to remove a device and the controller is not powered. --- src/adapter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index fc5b90f54..c952a181b 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2097,6 +2097,9 @@ static DBusMessage *remove_device(DBusConnection *conn, if (!list) return btd_error_does_not_exist(msg); + if (!(adapter->current_settings & MGMT_SETTING_POWERED)) + return btd_error_not_ready(msg); + device = list->data; device_set_temporary(device, TRUE); -- 2.47.3