summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxiaolu <server@163.com>2015-06-04 02:22:23 +0200
committerDees Troy <dees_troy@teamw.in>2015-06-17 23:17:06 +0200
commit9416f4f9d6542b616640c0fbb53899bbfc1859a2 (patch)
tree92a81eda01a581d6f02a303cff221885a1a9c6b8
parentFix ORS scripts displaying an error after completing (diff)
downloadandroid_bootable_recovery-9416f4f9d6542b616640c0fbb53899bbfc1859a2.tar
android_bootable_recovery-9416f4f9d6542b616640c0fbb53899bbfc1859a2.tar.gz
android_bootable_recovery-9416f4f9d6542b616640c0fbb53899bbfc1859a2.tar.bz2
android_bootable_recovery-9416f4f9d6542b616640c0fbb53899bbfc1859a2.tar.lz
android_bootable_recovery-9416f4f9d6542b616640c0fbb53899bbfc1859a2.tar.xz
android_bootable_recovery-9416f4f9d6542b616640c0fbb53899bbfc1859a2.tar.zst
android_bootable_recovery-9416f4f9d6542b616640c0fbb53899bbfc1859a2.zip
-rw-r--r--partition.cpp17
-rw-r--r--partitionmanager.cpp11
2 files changed, 13 insertions, 15 deletions
diff --git a/partition.cpp b/partition.cpp
index 9c5462d3e..e154564be 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -1051,7 +1051,7 @@ bool TWPartition::Mount(bool Display_Error) {
if (Removable)
Update_Size(Display_Error);
- if (!Symlink_Mount_Point.empty()) {
+ if (!Symlink_Mount_Point.empty() && TWFunc::Path_Exists(Symlink_Path)) {
string Command = "mount -o bind '" + Symlink_Path + "' '" + Symlink_Mount_Point + "'";
TWFunc::Exec_Cmd(Command);
}
@@ -2116,15 +2116,22 @@ void TWPartition::Recreate_Media_Folder(void) {
} else if (!TWFunc::Path_Exists("/data/media")) {
PartitionManager.Mount_By_Path(Symlink_Mount_Point, true);
LOGINFO("Recreating /data/media folder.\n");
- mkdir("/data/media", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ mkdir("/data/media", 0770);
+ string Internal_path = DataManager::GetStrValue("tw_internal_path");
+ if (!Internal_path.empty()) {
+ LOGINFO("Recreating %s folder.\n", Internal_path.c_str());
+ mkdir(Internal_path.c_str(), 0770);
+ }
+#ifdef TW_INTERNAL_STORAGE_PATH
+ mkdir(EXPAND(TW_INTERNAL_STORAGE_PATH), 0770);
+#endif
#ifdef HAVE_SELINUX
- // Attempt to set the correct SELinux contexts on the folder
- fixPermissions perms;
- perms.fixDataInternalContexts();
// Afterwards, we will try to set the
// default metadata that we were hopefully able to get during
// early boot.
tw_set_default_metadata("/data/media");
+ if (!Internal_path.empty())
+ tw_set_default_metadata(Internal_path.c_str());
#endif
// Toggle mount to ensure that "internal sdcard" gets mounted
PartitionManager.UnMount_By_Path(Symlink_Mount_Point, true);
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index 572cd7c93..0262648f1 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -1212,16 +1212,7 @@ int TWPartitionManager::Wipe_Media_From_Data(void) {
gui_print("Wiping internal storage -- /data/media...\n");
Remove_MTP_Storage(dat->MTP_Storage_ID);
TWFunc::removeDir("/data/media", false);
- if (mkdir("/data/media", S_IRWXU | S_IRWXG | S_IWGRP | S_IXGRP) != 0) {
- Add_MTP_Storage(dat->MTP_Storage_ID);
- return false;
- }
- if (dat->Has_Data_Media) {
- dat->Recreate_Media_Folder();
- // Unmount and remount - slightly hackish way to ensure that the "/sdcard" folder is still mounted properly after wiping
- dat->UnMount(false);
- dat->Mount(false);
- }
+ dat->Recreate_Media_Folder();
Add_MTP_Storage(dat->MTP_Storage_ID);
return true;
} else {