From 89c2c2177469776cc5e0c313adf90ef79cc06f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=8B=E9=A1=B5?= <31466456+canyie@users.noreply.github.com> Date: Fri, 29 Oct 2021 18:21:20 +0800 Subject: [PATCH] Fix init.rc path detection Fix #4319 Some devices store init.rc into the new path but still have the legacy /init.rc file --- native/jni/init/rootdir.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/native/jni/init/rootdir.cpp b/native/jni/init/rootdir.cpp index e7e44f230..a93ae7d96 100644 --- a/native/jni/init/rootdir.cpp +++ b/native/jni/init/rootdir.cpp @@ -285,12 +285,12 @@ void SARBase::patch_rootdir() { } // Patch init.rc - if (access("/init.rc", F_OK) == 0) { - patch_init_rc("/init.rc", ROOTOVL "/init.rc", tmp_dir.data()); - } else { + if (access(NEW_INITRC, F_OK) == 0) { // Android 11's new init.rc xmkdirs(dirname(ROOTOVL NEW_INITRC), 0755); patch_init_rc(NEW_INITRC, ROOTOVL NEW_INITRC, tmp_dir.data()); + } else { + patch_init_rc("/init.rc", ROOTOVL "/init.rc", tmp_dir.data()); } // Extract magisk