summaryrefslogtreecommitdiffstats
path: root/partition.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-01-09 20:48:21 +0100
committerDees_Troy <dees_troy@teamw.in>2013-01-09 20:49:19 +0100
commitce67546112ca718d5bbaf9fecadf3652f9c63df5 (patch)
treea914b4a9c8793d88eec087bcf6352b2da4c8c4ae /partition.cpp
parentImprove remounting sdcard with ecryptfs (diff)
downloadandroid_bootable_recovery-ce67546112ca718d5bbaf9fecadf3652f9c63df5.tar
android_bootable_recovery-ce67546112ca718d5bbaf9fecadf3652f9c63df5.tar.gz
android_bootable_recovery-ce67546112ca718d5bbaf9fecadf3652f9c63df5.tar.bz2
android_bootable_recovery-ce67546112ca718d5bbaf9fecadf3652f9c63df5.tar.lz
android_bootable_recovery-ce67546112ca718d5bbaf9fecadf3652f9c63df5.tar.xz
android_bootable_recovery-ce67546112ca718d5bbaf9fecadf3652f9c63df5.tar.zst
android_bootable_recovery-ce67546112ca718d5bbaf9fecadf3652f9c63df5.zip
Diffstat (limited to 'partition.cpp')
-rw-r--r--partition.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/partition.cpp b/partition.cpp
index 4a7a90023..44b00ab4c 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -760,6 +760,13 @@ bool TWPartition::Wipe(string New_File_System) {
if (Mount_Point == "/cache")
tmplog_offset = 0;
+#ifdef TW_INCLUDE_CRYPTO_SAMSUNG
+ if (Mount_Point == "/data" && Mount(false)) {
+ if (TWFunc::Path_Exists("/data/system/edk_p_sd"))
+ TWFunc::copy_file("/data/system/edk_p_sd", "/tmp/edk_p_sd", 0600);
+ }
+#endif
+
if (Has_Data_Media)
return Wipe_Data_Without_Wiping_Media();
@@ -775,7 +782,7 @@ bool TWPartition::Wipe(string New_File_System) {
wiped = Wipe_EXT23(New_File_System);
else if (New_File_System == "vfat")
wiped = Wipe_FAT();
- if (New_File_System == "exfat")
+ else if (New_File_System == "exfat")
wiped = Wipe_EXFAT();
else if (New_File_System == "yaffs2")
wiped = Wipe_MTD();
@@ -785,6 +792,14 @@ bool TWPartition::Wipe(string New_File_System) {
}
if (wiped) {
+#ifdef TW_INCLUDE_CRYPTO_SAMSUNG
+ if (Mount_Point == "/data" && Mount(false)) {
+ if (TWFunc::Path_Exists("/tmp/edk_p_sd")) {
+ Make_Dir("/data/system", true);
+ TWFunc::copy_file("/tmp/edk_p_sd", "/data/system/edk_p_sd", 0600);
+ }
+ }
+#endif
Setup_File_System(false);
if (Is_Encrypted && !Is_Decrypted) {
// just wiped an encrypted partition back to its unencrypted state
@@ -1178,10 +1193,23 @@ bool TWPartition::Wipe_Data_Without_Wiping_Media() {
dir = "/data/";
dir.append(de->d_name);
- TWFunc::removeDir(dir, false);
+ if (de->d_type == DT_DIR) {
+ TWFunc::removeDir(dir, false);
+ } else if (de->d_type == DT_REG || de->d_type == DT_LNK) {
+ if (!unlink(dir.c_str()))
+ LOGI("Unable to unlink '%s'\n", dir.c_str());
+ }
}
closedir(d);
ui_print("Done.\n");
+#ifdef TW_INCLUDE_CRYPTO_SAMSUNG
+ if (Mount_Point == "/data" && Mount(false)) {
+ if (TWFunc::Path_Exists("/tmp/edk_p_sd")) {
+ Make_Dir("/data/system", true);
+ TWFunc::copy_file("/tmp/edk_p_sd", "/data/system/edk_p_sd", 0600);
+ }
+ }
+#endif
return true;
}
ui_print("Dirent failed to open /data, error!\n");