diff --git a/native/jni/core/scripting.cpp b/native/jni/core/scripting.cpp index 78413c727..a022a3e28 100644 --- a/native/jni/core/scripting.cpp +++ b/native/jni/core/scripting.cpp @@ -10,10 +10,15 @@ using namespace std; -#define BBEXEC_CMD DATABIN "/busybox", "sh", "-o", "standalone" +#define BBEXEC_CMD DATABIN "/busybox", "sh" + +static void set_standalone() { + setenv("ASH_STANDALONE", "1", 1); +}; void exec_script(const char *script) { exec_t exec { + .pre_exec = set_standalone, .fork = fork_no_zombie }; exec_command_sync(exec, BBEXEC_CMD, script); @@ -37,6 +42,7 @@ void exec_common_script(const char *stage) { LOGI("%s.d: exec [%s]\n", stage, entry->d_name); strcpy(name, entry->d_name); exec_t exec { + .pre_exec = set_standalone, .fork = pfs ? fork_no_zombie : fork_dont_care }; if (pfs) @@ -57,6 +63,7 @@ void exec_module_script(const char *stage, const vector &module_list) { continue; LOGI("%s: exec [%s.sh]\n", module, stage); exec_t exec { + .pre_exec = set_standalone, .fork = pfs ? fork_no_zombie : fork_dont_care }; if (pfs) @@ -76,6 +83,7 @@ rm -f $APK void install_apk(const char *apk) { setfilecon(apk, "u:object_r:" SEPOL_FILE_DOMAIN ":s0"); exec_t exec { + .pre_exec = set_standalone, .fork = fork_no_zombie }; char cmds[sizeof(install_script) + 4096];