diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2013-06-07 15:15:29 +0300 |
---|---|---|
committer | Alok Barsode <alok.barsode@intel.com> | 2013-08-14 04:11:15 -0700 |
commit | 4a631b073fc92bc422569d336791c842c389b092 (patch) | |
tree | 62ef189012e7348dfc33e153ce4657263e90b90d | |
parent | e18565fc70b9c985a683e08a4668cf97111e88fc (diff) | |
download | connman-4a631b073fc92bc422569d336791c842c389b092.tar.gz connman-4a631b073fc92bc422569d336791c842c389b092.tar.bz2 connman-4a631b073fc92bc422569d336791c842c389b092.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
Upstream commit id:b4f0e902a111e29451ff604bb00795363d0093aa
-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 3b8f6a82..8addf1c3 100644 --- a/src/technology.c +++ b/src/technology.c @@ -1506,7 +1506,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; @@ -1530,12 +1530,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 |