am 1206e872: resolved conflicts for merge of 09f774b7 to gingerbread-plus-aosp
* commit '1206e872ce74aab253c39c3547bfaadc5e1f6011':
vold: fix an offset one bug that makes partition 4 unusable
vold: set state back to idle on formatting error
diff --git a/DirectVolume.cpp b/DirectVolume.cpp
index 0960724..3191cc7 100644
--- a/DirectVolume.cpp
+++ b/DirectVolume.cpp
@@ -197,8 +197,8 @@
#ifdef PARTITION_DEBUG
SLOGD("Dv:partAdd: part_num = %d, minor = %d\n", part_num, minor);
#endif
- if (part_num >= MAX_PARTITIONS) {
- SLOGE("Dv:partAdd: ignoring part_num = %d (max: %d)\n", part_num, MAX_PARTITIONS-1);
+ if (part_num > MAX_PARTITIONS) {
+ SLOGE("Dv:partAdd: ignoring part_num = %d (max: %d)\n", part_num, MAX_PARTITIONS);
} else {
mPartMinors[part_num -1] = minor;
}
diff --git a/Volume.cpp b/Volume.cpp
index 416d8c6..d67a6c4 100644
--- a/Volume.cpp
+++ b/Volume.cpp
@@ -219,6 +219,7 @@
setState(Volume::State_Formatting);
+ int ret = -1;
// Only initialize the MBR if we are formatting the entire device
if (formatEntireDevice) {
sprintf(devicePath, "/dev/block/vold/%d:%d",
@@ -242,10 +243,11 @@
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) {