From 33f51542693ed6a14fd75bfcda780166f27a1268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=8B=E9=A1=B5?= <31466456+canyie@users.noreply.github.com> Date: Wed, 14 Dec 2022 05:54:55 +0800 Subject: [PATCH] Inject binaries into /system if sbin not accessible Some Android 11+ devices have the /sbin partition but not accessible by the global shell (`PATH` doesn't contain `/sbin`). Not only custom ROMs but also some stock ROMs have the same behavior so I believe it is something we need to deal with. Fix #6427, fix #4309, fix #5728, fix #3593 --- native/src/core/module.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/src/core/module.cpp b/native/src/core/module.cpp index 7a269336e..6967cf51f 100644 --- a/native/src/core/module.cpp +++ b/native/src/core/module.cpp @@ -614,7 +614,7 @@ void magic_mount() { system->collect_files(module, fd); close(fd); } - if (MAGISKTMP != "/sbin") { + if (MAGISKTMP != "/sbin" || !str_contains(getenv("PATH") ?: "", "/sbin")) { // Need to inject our binaries into /system/bin inject_magisk_bins(system); }