summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYing An Deng <ying.an.deng@intel.com>2010-08-03 14:48:33 (GMT)
committerSamuel Ortiz <sameo@linux.intel.com>2010-08-03 15:31:52 (GMT)
commit64439d8d3edfe4fe7d2423dfa1156097fa1869bd (patch)
treeb48d0ea8da4ce0febe7829bfa4f0ff63db0718b0
parent2c6ac17474f9307811b322af04738c3fe39a56bb (diff)
downloadconnman-64439d8d3edfe4fe7d2423dfa1156097fa1869bd.zip
connman-64439d8d3edfe4fe7d2423dfa1156097fa1869bd.tar.gz
connman-64439d8d3edfe4fe7d2423dfa1156097fa1869bd.tar.bz2
Toggle offline mode only if device enablement succeeds
-rw-r--r--src/device.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/device.c b/src/device.c
index fc72544..aab0c83 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1056,16 +1056,22 @@ int __connman_device_enable(struct connman_device *device)
int __connman_device_enable_persistent(struct connman_device *device)
{
+ int err;
+
DBG("device %p", device);
device->powered_persistent = TRUE;
- if (__connman_profile_get_offlinemode() == TRUE)
- __connman_profile_set_offlinemode(FALSE, FALSE);
-
__connman_storage_save_device(device);
- return __connman_device_enable(device);
+ err = __connman_device_enable(device);
+ if (err == 0 || err == -EINPROGRESS) {
+ if (__connman_profile_get_offlinemode() == TRUE)
+ __connman_profile_set_offlinemode(FALSE, FALSE);
+
+ }
+
+ return err;
}
int __connman_device_disable(struct connman_device *device)