Skip to content

Commit

Permalink
Fix sepolicy rule path
Browse files Browse the repository at this point in the history
  • Loading branch information
yujincheng08 authored and topjohnwu committed Jul 25, 2024
1 parent 0dc596e commit f488e9d
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions native/src/init/selinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,10 @@ bool MagiskInit::hijack_sepolicy() {

// Read all custom rules into memory
string rules;
if (auto dir = xopen_dir("/data/" PREINITMIRR)) {
for (dirent *entry; (entry = xreaddir(dir.get()));) {
auto name = "/data/" PREINITMIRR "/"s + entry->d_name;
auto rule_file = name + "/sepolicy.rule";
if (xaccess(rule_file.data(), R_OK) == 0 &&
access((name + "/disable").data(), F_OK) != 0 &&
access((name + "/remove").data(), F_OK) != 0) {
LOGD("Load custom sepolicy patch: [%s]\n", rule_file.data());
full_read(rule_file.data(), rules);
rules += '\n';
}
}
auto rule = "/data/" PREINITMIRR "/sepolicy.rule";
if (xaccess(rule, R_OK) == 0) {
LOGD("Loading custom sepolicy patch: [%s]\n", rule);
rules = full_read(rule);
}
// Create a new process waiting for init operations
if (xfork()) {
Expand Down

1 comment on commit f488e9d

@aviraxp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest releasing 27006. 27005 is almost unusable because of the bug this commit fixes.

Please sign in to comment.