Fix mount rules dir

close #4006
This commit is contained in:
vvb2060
2021-03-13 22:13:39 +08:00
committed by John Wu
parent afe3c2bc1b
commit 0783f3d5b6
4 changed files with 19 additions and 6 deletions

View File

@ -100,10 +100,10 @@ bool MagiskInit::patch_sepolicy(const char *file) {
// Custom rules
if (!custom_rules_dir.empty()) {
if (auto dir = open_dir(custom_rules_dir.data())) {
if (auto dir = xopen_dir(custom_rules_dir.data())) {
for (dirent *entry; (entry = xreaddir(dir.get()));) {
auto rule = custom_rules_dir + "/" + entry->d_name + "/sepolicy.rule";
if (access(rule.data(), R_OK) == 0) {
if (xaccess(rule.data(), R_OK) == 0) {
LOGD("Loading custom sepolicy patch: [%s]\n", rule.data());
sepol->load_rule_file(rule.data());
}