summaryrefslogtreecommitdiffstats
path: root/partition.cpp
diff options
context:
space:
mode:
authorthat <github@that.at>2014-12-21 22:27:40 +0100
committerDees Troy <dees_troy@teamw.in>2014-12-22 04:52:37 +0100
commita3d31fbe385094400719e9a7a79965ff5da9f4b4 (patch)
tree2f4bb3239063c127dc37089b0cc85f10bb43fa31 /partition.cpp
parentAllow non datamedia devices to wipe encryption (diff)
downloadandroid_bootable_recovery-a3d31fbe385094400719e9a7a79965ff5da9f4b4.tar
android_bootable_recovery-a3d31fbe385094400719e9a7a79965ff5da9f4b4.tar.gz
android_bootable_recovery-a3d31fbe385094400719e9a7a79965ff5da9f4b4.tar.bz2
android_bootable_recovery-a3d31fbe385094400719e9a7a79965ff5da9f4b4.tar.lz
android_bootable_recovery-a3d31fbe385094400719e9a7a79965ff5da9f4b4.tar.xz
android_bootable_recovery-a3d31fbe385094400719e9a7a79965ff5da9f4b4.tar.zst
android_bootable_recovery-a3d31fbe385094400719e9a7a79965ff5da9f4b4.zip
Diffstat (limited to '')
-rw-r--r--partition.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/partition.cpp b/partition.cpp
index 409a688d5..80eb5aa83 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -1654,9 +1654,6 @@ bool TWPartition::Wipe_Data_Without_Wiping_Media() {
return Wipe_Encryption();
#else
string dir;
- #ifdef HAVE_SELINUX
- fixPermissions perms;
- #endif
// This handles wiping data on devices with "sdcard" in /data/media
if (!Mount(true))
@@ -2018,10 +2015,6 @@ void TWPartition::Find_Actual_Block_Device(void) {
void TWPartition::Recreate_Media_Folder(void) {
string Command;
- #ifdef HAVE_SELINUX
- fixPermissions perms;
- #endif
-
if (!Mount(true)) {
LOGERR("Unable to recreate /data/media folder.\n");
} else if (!TWFunc::Path_Exists("/data/media")) {
@@ -2029,7 +2022,13 @@ void TWPartition::Recreate_Media_Folder(void) {
LOGINFO("Recreating /data/media folder.\n");
mkdir("/data/media", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
#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");
#endif
// Toggle mount to ensure that "internal sdcard" gets mounted
PartitionManager.UnMount_By_Path(Symlink_Mount_Point, true);