Allow per device unsafe-to-format partition list
The change switches is_safe_to_format() from a hard coded list
to a list that can be overwritten by system property.
Change-Id: Ie536044a912c3e88462831851d288a60fdc30e2b
diff --git a/extendedcommands.c b/extendedcommands.c
index e5daa5a..2e3fa51 100644
--- a/extendedcommands.c
+++ b/extendedcommands.c
@@ -490,8 +490,19 @@
int is_safe_to_format(char* name)
{
- return !(strcmp(name, "/misc") == 0 || strcmp(name, "/radio") == 0
- || strcmp(name, "/bootloader") == 0 || strcmp(name, "/recovery") == 0);
+ char str[255];
+ char* partition;
+ property_get("ro.recovery.format_ignore_partitions", str, "/misc,/radio,/bootloader,/recovery");
+
+ partition = strtok(str, ", ");
+ while (partition != NULL) {
+ if (strcmp(name, partition) == 0) {
+ return 0;
+ }
+ partition = strtok(NULL, ", ");
+ }
+
+ return 1;
}
void show_partition_menu()