summaryrefslogtreecommitdiffstats
path: root/partition.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2012-10-13 17:56:13 +0200
committerDees_Troy <dees_troy@teamw.in>2012-10-13 17:56:52 +0200
commit0550cfb483d00bbef2b0c3b0e83581c3679d8ba9 (patch)
tree26d2bf822646898cc278495e58ea4f793c19ed31 /partition.cpp
parentUnmount main partitions after USB storage disable (diff)
downloadandroid_bootable_recovery-0550cfb483d00bbef2b0c3b0e83581c3679d8ba9.tar
android_bootable_recovery-0550cfb483d00bbef2b0c3b0e83581c3679d8ba9.tar.gz
android_bootable_recovery-0550cfb483d00bbef2b0c3b0e83581c3679d8ba9.tar.bz2
android_bootable_recovery-0550cfb483d00bbef2b0c3b0e83581c3679d8ba9.tar.lz
android_bootable_recovery-0550cfb483d00bbef2b0c3b0e83581c3679d8ba9.tar.xz
android_bootable_recovery-0550cfb483d00bbef2b0c3b0e83581c3679d8ba9.tar.zst
android_bootable_recovery-0550cfb483d00bbef2b0c3b0e83581c3679d8ba9.zip
Diffstat (limited to '')
-rw-r--r--partition.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/partition.cpp b/partition.cpp
index af229294f..bc8e24052 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -1301,11 +1301,12 @@ bool TWPartition::Restore_Flash_Image(string restore_folder) {
}
bool TWPartition::Update_Size(bool Display_Error) {
- bool ret = false;
+ bool ret = false, Was_Already_Mounted = false;
if (!Can_Be_Mounted && !Is_Encrypted)
return false;
+ Was_Already_Mounted = Is_Mounted();
if (Removable || Is_Encrypted) {
if (!Mount(false))
return true;
@@ -1313,9 +1314,13 @@ bool TWPartition::Update_Size(bool Display_Error) {
return false;
ret = Get_Size_Via_statfs(Display_Error);
- if (!ret || Size == 0)
- if (!Get_Size_Via_df(Display_Error))
+ if (!ret || Size == 0) {
+ if (!Get_Size_Via_df(Display_Error)) {
+ if (!Was_Already_Mounted)
+ UnMount(false);
return false;
+ }
+ }
if (Has_Data_Media) {
if (Mount(Display_Error)) {
@@ -1330,14 +1335,22 @@ bool TWPartition::Update_Size(bool Display_Error) {
int fre = (int)(Free / 1048576LLU);
int datmed = (int)(data_media_used / 1048576LLU);
LOGI("Data backup size is %iMB, size: %iMB, used: %iMB, free: %iMB, in data/media: %iMB.\n", bak, total, us, fre, datmed);
- } else
+ } else {
+ if (!Was_Already_Mounted)
+ UnMount(false);
return false;
+ }
} else if (Has_Android_Secure) {
if (Mount(Display_Error))
Backup_Size = TWFunc::Get_Folder_Size(Backup_Path, Display_Error);
- else
+ else {
+ if (!Was_Already_Mounted)
+ UnMount(false);
return false;
+ }
}
+ if (!Was_Already_Mounted)
+ UnMount(false);
return true;
}