summaryrefslogtreecommitdiffstats
path: root/twrp-functions.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2014-02-06 21:33:02 +0100
committerEthan Yonker <dees_troy@teamw.in>2014-02-08 04:54:33 +0100
commit0385f518570c18cefacf41c86e0aa02043c9f18c (patch)
tree29769e9c77dc3a84575fe5622c458df542c60fc2 /twrp-functions.cpp
parentSeparate out function for reading /system/build.prop values (diff)
downloadandroid_bootable_recovery-0385f518570c18cefacf41c86e0aa02043c9f18c.tar
android_bootable_recovery-0385f518570c18cefacf41c86e0aa02043c9f18c.tar.gz
android_bootable_recovery-0385f518570c18cefacf41c86e0aa02043c9f18c.tar.bz2
android_bootable_recovery-0385f518570c18cefacf41c86e0aa02043c9f18c.tar.lz
android_bootable_recovery-0385f518570c18cefacf41c86e0aa02043c9f18c.tar.xz
android_bootable_recovery-0385f518570c18cefacf41c86e0aa02043c9f18c.tar.zst
android_bootable_recovery-0385f518570c18cefacf41c86e0aa02043c9f18c.zip
Diffstat (limited to 'twrp-functions.cpp')
-rw-r--r--twrp-functions.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 420982452..bbd3c4c9f 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -559,13 +559,21 @@ bool TWFunc::Fix_su_Perms(void) {
if (!PartitionManager.Mount_By_Path("/system", true))
return false;
+ string propvalue = System_Property_Get("ro.build.version.sdk");
+ string su_perms = "6755";
+ if (!propvalue.empty()) {
+ int sdk_version = atoi(propvalue.c_str());
+ if (sdk_version >= 18)
+ su_perms = "0755";
+ }
+
string file = "/system/bin/su";
if (TWFunc::Path_Exists(file)) {
if (chown(file.c_str(), 0, 0) != 0) {
LOGERR("Failed to chown '%s'\n", file.c_str());
return false;
}
- if (tw_chmod(file, "6755") != 0) {
+ if (tw_chmod(file, su_perms) != 0) {
LOGERR("Failed to chmod '%s'\n", file.c_str());
return false;
}
@@ -576,7 +584,7 @@ bool TWFunc::Fix_su_Perms(void) {
LOGERR("Failed to chown '%s'\n", file.c_str());
return false;
}
- if (tw_chmod(file, "6755") != 0) {
+ if (tw_chmod(file, su_perms) != 0) {
LOGERR("Failed to chmod '%s'\n", file.c_str());
return false;
}
@@ -587,7 +595,7 @@ bool TWFunc::Fix_su_Perms(void) {
LOGERR("Failed to chown '%s'\n", file.c_str());
return false;
}
- if (tw_chmod(file, "6755") != 0) {
+ if (tw_chmod(file, "0755") != 0) {
LOGERR("Failed to chmod '%s'\n", file.c_str());
return false;
}
@@ -598,7 +606,7 @@ bool TWFunc::Fix_su_Perms(void) {
LOGERR("Failed to chown '%s'\n", file.c_str());
return false;
}
- if (tw_chmod(file, "6755") != 0) {
+ if (tw_chmod(file, su_perms) != 0) {
LOGERR("Failed to chmod '%s'\n", file.c_str());
return false;
}