summaryrefslogtreecommitdiffstats
path: root/Volume.cpp
diff options
context:
space:
mode:
authorChih-Wei Huang <cwhuang@linux.org.tw>2010-11-16 13:18:19 +0800
committerChih-Wei Huang <cwhuang@linux.org.tw>2010-11-16 13:27:36 +0800
commit64382de1f93b84ca59f607da4b4fdbd77f1af67d (patch)
treed8a6eddb0f0c20994fbf2fd70d6fd01d4ca92724 /Volume.cpp
parent75a3e1a95af0a2790de1b12aeca0008bfdc61649 (diff)
downloadsystem_vold-64382de1f93b84ca59f607da4b4fdbd77f1af67d.zip
system_vold-64382de1f93b84ca59f607da4b4fdbd77f1af67d.tar.gz
system_vold-64382de1f93b84ca59f607da4b4fdbd77f1af67d.tar.bz2
vold: set state back to idle on formatting error
On formatting error due to some reasons, the state is left at Formatting, therefore the user is unable to mount the sdcard again. The patch sets the state to Idle no matter formatting error or not. Change-Id: I62c78eb8299cc397ee5cc442890f8b3dbf09425c
Diffstat (limited to 'Volume.cpp')
-rw-r--r--Volume.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Volume.cpp b/Volume.cpp
index 2f3cad5..4ac086b 100644
--- a/Volume.cpp
+++ b/Volume.cpp
@@ -213,6 +213,7 @@ int Volume::formatVol() {
}
setState(Volume::State_Formatting);
+ int ret = -1;
if (initializeMbr(devicePath)) {
SLOGE("Failed to initialize MBR (%s)", strerror(errno));
goto err;
@@ -226,10 +227,11 @@ int Volume::formatVol() {
goto err;
}
- setState(Volume::State_Idle);
- return 0;
+ ret = 0;
+
err:
- return -1;
+ setState(Volume::State_Idle);
+ return ret;
}
bool Volume::isMountpointMounted(const char *path) {