diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2013-06-07 15:15:29 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2013-06-10 09:48:54 +0300 |
commit | b4f0e902a111e29451ff604bb00795363d0093aa (patch) | |
tree | 73ecfbcea75b95e71a5050f44b149f6facb4a64d | |
parent | 4c50210d0d16b5fcdc4f6ef1c9498d25689649ff (diff) | |
download | connman-b4f0e902a111e29451ff604bb00795363d0093aa.tar.gz connman-b4f0e902a111e29451ff604bb00795363d0093aa.tar.bz2 connman-b4f0e902a111e29451ff604bb00795363d0093aa.zip |
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.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/technology.c b/src/technology.c index f210859d..632f7164 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 |