fix android secure formatting
Change-Id: I617b8c453aad6d306cf8ddbc1a067c59ead56573
diff --git a/Android.mk b/Android.mk
index 748f70c..3dac199 100644
--- a/Android.mk
+++ b/Android.mk
@@ -26,7 +26,7 @@
LOCAL_FORCE_STATIC_EXECUTABLE := true
-RECOVERY_VERSION := ClockworkMod Recovery v3.0.0.4
+RECOVERY_VERSION := ClockworkMod Recovery v3.0.0.5
LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
RECOVERY_API_VERSION := 2
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
diff --git a/extendedcommands.c b/extendedcommands.c
index f2f1d6c..a96ce27 100644
--- a/extendedcommands.c
+++ b/extendedcommands.c
@@ -460,26 +460,8 @@
// device may simply be a name, like "system"
if (device[0] != '/')
return erase_partition(device, fs_type);
-
- if (strcmp("ext3", fs_type) == 0) {
- LOGI("Formatting ext3 device.\n");
- if (0 != ensure_path_unmounted(path)) {
- LOGE("Error while unmounting %s.\n", path);
- return -12;
- }
- return format_ext3_device(device);
- }
-
- if (strcmp("ext2", fs_type) == 0) {
- LOGI("Formatting ext2 device.\n");
- if (0 != ensure_path_unmounted(path)) {
- LOGE("Error while unmounting %s.\n", path);
- return -12;
- }
- return format_ext2_device(device);
- }
- // if this is SDEXT:, don't worry about it.
+ // if this is SDEXT:, don't worry about it if it does not exist.
if (0 == strcmp(path, "/sd-ext"))
{
struct stat st;
@@ -491,6 +473,26 @@
}
}
+ if (NULL != fs_type) {
+ if (strcmp("ext3", fs_type) == 0) {
+ LOGI("Formatting ext3 device.\n");
+ if (0 != ensure_path_unmounted(path)) {
+ LOGE("Error while unmounting %s.\n", path);
+ return -12;
+ }
+ return format_ext3_device(device);
+ }
+
+ if (strcmp("ext2", fs_type) == 0) {
+ LOGI("Formatting ext2 device.\n");
+ if (0 != ensure_path_unmounted(path)) {
+ LOGE("Error while unmounting %s.\n", path);
+ return -12;
+ }
+ return format_ext2_device(device);
+ }
+ }
+
if (0 != ensure_path_mounted(path))
{
ui_print("Error mounting %s!\n", path);
diff --git a/roots.c b/roots.c
index 4f76de5..028fbc4 100644
--- a/roots.c
+++ b/roots.c
@@ -213,8 +213,11 @@
return -1;
}
if (strcmp(v->mount_point, volume) != 0) {
+#if 0
LOGE("can't give path \"%s\" to format_volume\n", volume);
return -1;
+#endif
+ return format_unknown_device(v->device, volume, NULL);
}
if (ensure_path_unmounted(volume) != 0) {