diff options
author | Chih-Wei Huang <cwhuang@linux.org.tw> | 2010-11-16 13:18:19 +0800 |
---|---|---|
committer | Chih-Wei Huang <cwhuang@linux.org.tw> | 2010-11-16 13:27:36 +0800 |
commit | 64382de1f93b84ca59f607da4b4fdbd77f1af67d (patch) | |
tree | d8a6eddb0f0c20994fbf2fd70d6fd01d4ca92724 /Volume.cpp | |
parent | 75a3e1a95af0a2790de1b12aeca0008bfdc61649 (diff) | |
download | system_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.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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) { |