diff --git a/native/src/init/selinux.cpp b/native/src/init/selinux.cpp index e7109ae47..9740c0928 100644 --- a/native/src/init/selinux.cpp +++ b/native/src/init/selinux.cpp @@ -15,17 +15,10 @@ void MagiskInit::patch_sepolicy(const char *in, const char *out) { sepol->magisk_rules(); // Custom 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 = name + "/sepolicy.rule"; - if (xaccess(rule.data(), R_OK) == 0 && - access((name + "/disable").data(), F_OK) != 0 && - access((name + "/remove").data(), F_OK) != 0) { - LOGD("Loading custom sepolicy patch: [%s]\n", rule.data()); - sepol->load_rule_file(rule.data()); - } - } + auto rule = "/data/" PREINITMIRR "/sepolicy.rule"; + if (xaccess(rule, R_OK) == 0) { + LOGD("Loading custom sepolicy patch: [%s]\n", rule); + sepol->load_rule_file(rule); } LOGD("Dumping sepolicy to: [%s]\n", out); diff --git a/scripts/util_functions.sh b/scripts/util_functions.sh index e244d6c92..b942afbff 100644 --- a/scripts/util_functions.sh +++ b/scripts/util_functions.sh @@ -583,7 +583,7 @@ copy_preinit_files() { [ -f $MODDIR/update ] && continue cat $r echo - done > $PREINITDIR/0/sepolicy.rule + done > $PREINITDIR/sepolicy.rule } #################