From b1dbbdef12a5396f6b3908d596d4b75bb53a40d7 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Mon, 25 Jan 2021 00:23:42 -0800 Subject: [PATCH] Remove unneeded busybox redirection --- native/jni/core/bootstages.cpp | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/native/jni/core/bootstages.cpp b/native/jni/core/bootstages.cpp index aedffb6e2..0e153742a 100644 --- a/native/jni/core/bootstages.cpp +++ b/native/jni/core/bootstages.cpp @@ -99,13 +99,6 @@ static void mount_mirrors() { link_mirror(system_ext) } -constexpr char bb_script[] = R"EOF( -#!/system/bin/sh -BB=%s -[ -x $BB ] && exec $BB "$@" -exec /data/adb/magisk/busybox.bin "$@" -)EOF"; - static bool magisk_env() { char buf[4096]; @@ -153,20 +146,12 @@ static bool magisk_env() { unlink("/sbin/magiskhide"); } - if (access(DATABIN "/busybox.bin", X_OK)) { - if (access(DATABIN "/busybox", X_OK)) - return false; - rename(DATABIN "/busybox", DATABIN "/busybox.bin"); - } + if (access(DATABIN "/busybox", X_OK)) + return false; sprintf(buf, "%s/" BBPATH "/busybox", MAGISKTMP.data()); - { - auto fp = open_file(DATABIN "/busybox", "we"); - fprintf(fp.get(), bb_script, buf); - } - chmod(DATABIN "/busybox", 0755); mkdir(dirname(buf), 0755); - cp_afc(DATABIN "/busybox.bin", buf); + cp_afc(DATABIN "/busybox", buf); exec_command_async(buf, "--install", "-s", dirname(buf)); return true;