summaryrefslogtreecommitdiffstats
path: root/twrp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'twrp.cpp')
-rw-r--r--twrp.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/twrp.cpp b/twrp.cpp
index 3e56af2d5..06532cba2 100644
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -123,7 +123,17 @@ int main(int argc, char **argv) {
printf("SELinux contexts loaded from /file_contexts\n");
{ // Check to ensure SELinux can be supported by the kernel
char *contexts = NULL;
- lgetfilecon("/sbin/teamwin", &contexts);
+
+ if (PartitionManager.Mount_By_Path("/cache", true) && TWFunc::Path_Exists("/cache/recovery")) {
+ lgetfilecon("/cache/recovery", &contexts);
+ if (!contexts) {
+ lsetfilecon("/cache/recovery", "test");
+ lgetfilecon("/cache/recovery", &contexts);
+ }
+ } else {
+ LOGINFO("Could not check /cache/recovery SELinux contexts, using /sbin/teamwin instead which may be inaccurate.\n");
+ lgetfilecon("/sbin/teamwin", &contexts);
+ }
if (!contexts) {
gui_print("Kernel does not have support for reading SELinux contexts.\n");
} else {