summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2013-06-07 12:15:29 (GMT)
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-06-10 06:48:54 (GMT)
commitb4f0e902a111e29451ff604bb00795363d0093aa (patch)
tree73ecfbcea75b95e71a5050f44b149f6facb4a64d
parent4c50210d0d16b5fcdc4f6ef1c9498d25689649ff (diff)
downloadconnman-b4f0e902a111e29451ff604bb00795363d0093aa.zip
connman-b4f0e902a111e29451ff604bb00795363d0093aa.tar.gz
connman-b4f0e902a111e29451ff604bb00795363d0093aa.tar.bz2
technology: Offlinemode could not be disabled if no technology was powered
If all the technologies were powered off, then offline mode could not be disabled. Fixes BMC#26018
-rw-r--r--src/technology.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/technology.c b/src/technology.c
index f210859..632f716 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -1472,7 +1472,7 @@ int __connman_technology_disabled(enum connman_service_type type)
int __connman_technology_set_offlinemode(connman_bool_t offlinemode)
{
GSList *list;
- int err = -EINVAL;
+ int err = -EINVAL, enabled_tech_count = 0;
if (global_offlinemode == offlinemode)
return 0;
@@ -1496,12 +1496,16 @@ int __connman_technology_set_offlinemode(connman_bool_t offlinemode)
if (offlinemode)
err = technology_disable(technology);
-
- if (!offlinemode && technology->enable_persistent)
- err = technology_enable(technology);
+ else {
+ if (technology->enable_persistent) {
+ err = technology_enable(technology);
+ enabled_tech_count++;
+ }
+ }
}
- if (err == 0 || err == -EINPROGRESS || err == -EALREADY) {
+ if (err == 0 || err == -EINPROGRESS || err == -EALREADY ||
+ (err == -EINVAL && enabled_tech_count == 0)) {
connman_technology_save_offlinemode();
__connman_notifier_offlinemode(offlinemode);
} else