clean code

This commit is contained in:
vvb2060 2024-07-18 18:40:45 +08:00 committed by John Wu
parent 9a00b7b942
commit 2282365cf8
2 changed files with 5 additions and 12 deletions

View File

@ -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);

View File

@ -583,7 +583,7 @@ copy_preinit_files() {
[ -f $MODDIR/update ] && continue
cat $r
echo
done > $PREINITDIR/0/sepolicy.rule
done > $PREINITDIR/sepolicy.rule
}
#################