fix android secure formatting
Change-Id: I617b8c453aad6d306cf8ddbc1a067c59ead56573
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);