When devices are enabled or disabled, report any error except -EALREADY
to the caller.
---
 src/technology.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/technology.c b/src/technology.c
index 8b26af0..55303a0 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -618,8 +618,8 @@ static gboolean technology_pending_reply(gpointer user_data)
 static int technology_affect_devices(struct connman_technology *technology,
                                                bool enable_device)
 {
+       int err = 0, err_dev;
        GSList *list;
-       int err = -ENXIO;
 
        if (technology->type == CONNMAN_SERVICE_TYPE_P2P) {
                if (enable_device)
@@ -633,9 +633,12 @@ static int technology_affect_devices(struct 
connman_technology *technology,
                struct connman_device *device = list->data;
 
                if (enable_device)
-                       err = __connman_device_enable(device);
+                       err_dev = __connman_device_enable(device);
                else
-                       err = __connman_device_disable(device);
+                       err_dev = __connman_device_disable(device);
+
+               if (err_dev < 0 && err_dev != -EALREADY)
+                       err = err_dev;
        }
 
        return err;
-- 
2.1.4

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to