Skip to content

Commit

Permalink
technology: Offlinemode could not be disabled if no technology was po…
Browse files Browse the repository at this point in the history
…wered

If all the technologies were powered off, then offline mode could
not be disabled.

Fixes BMC#26018
  • Loading branch information
jukkar authored and pfl committed Jun 10, 2013
1 parent 4c50210 commit b4f0e90
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/technology.c
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit b4f0e90

Please sign in to comment.