summaryrefslogtreecommitdiffstats
path: root/partitionmanager.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2016-01-28 21:03:33 +0100
committerDees Troy <dees_troy@teamw.in>2016-01-29 21:58:33 +0100
commitb5fab76bea98dff8d0825d16c3dd359397449e9a (patch)
treea92cf2c085a22c8f246543f558619edd5fd3367e /partitionmanager.cpp
parentadds TW_ADDITIONAL_RES to TW_RES (diff)
downloadandroid_bootable_recovery-b5fab76bea98dff8d0825d16c3dd359397449e9a.tar
android_bootable_recovery-b5fab76bea98dff8d0825d16c3dd359397449e9a.tar.gz
android_bootable_recovery-b5fab76bea98dff8d0825d16c3dd359397449e9a.tar.bz2
android_bootable_recovery-b5fab76bea98dff8d0825d16c3dd359397449e9a.tar.lz
android_bootable_recovery-b5fab76bea98dff8d0825d16c3dd359397449e9a.tar.xz
android_bootable_recovery-b5fab76bea98dff8d0825d16c3dd359397449e9a.tar.zst
android_bootable_recovery-b5fab76bea98dff8d0825d16c3dd359397449e9a.zip
Diffstat (limited to '')
-rw-r--r--partitionmanager.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index 81d448dc6..89580d069 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -37,7 +37,7 @@
#include "partitions.hpp"
#include "data.hpp"
#include "twrp-functions.hpp"
-#include "fixPermissions.hpp"
+#include "fixContexts.hpp"
#include "twrpDigest.hpp"
#include "twrpDU.hpp"
#include "set_metadata.h"
@@ -1490,25 +1490,24 @@ int TWPartitionManager::Decrypt_Device(string Password) {
return 1;
}
-int TWPartitionManager::Fix_Permissions(void) {
- int result = 0;
- if (!Mount_By_Path("/data", true))
- return false;
-
- if (!Mount_By_Path("/system", true))
- return false;
-
- Mount_By_Path("/sd-ext", false);
-
- fixPermissions perms;
- result = perms.fixPerms(true, false);
+int TWPartitionManager::Fix_Contexts(void) {
#ifdef HAVE_SELINUX
- if (result == 0 && DataManager::GetIntValue("tw_fixperms_restorecon") == 1)
- result = perms.fixContexts();
-#endif
+ std::vector<TWPartition*>::iterator iter;
+ for (iter = Partitions.begin(); iter != Partitions.end(); iter++) {
+ if ((*iter)->Has_Data_Media) {
+ if ((*iter)->Mount(true)) {
+ if (fixContexts::fixDataMediaContexts((*iter)->Mount_Point) != 0)
+ return -1;
+ }
+ }
+ }
UnMount_Main_Partitions();
gui_msg("done=Done.");
- return result;
+ return 0;
+#else
+ LOGERR("Cannot fix contexts, no selinux support present.\n");
+ return -1;
+#endif
}
TWPartition* TWPartitionManager::Find_Next_Storage(string Path, bool Exclude_Data_Media) {