Use raw execve

Some devices have broken libc...
This commit is contained in:
topjohnwu 2018-11-28 00:07:57 -05:00
parent 1134b18a8b
commit f69a004c1c
2 changed files with 4 additions and 4 deletions

View File

@ -319,7 +319,7 @@ static void exec_common_script(const char* stage) {
LOGI("%s.d: exec [%s]\n", stage, entry->d_name); LOGI("%s.d: exec [%s]\n", stage, entry->d_name);
int pid = exec_command(false, nullptr, int pid = exec_command(false, nullptr,
strcmp(stage, "post-fs-data") ? set_path : set_mirror_path, strcmp(stage, "post-fs-data") ? set_path : set_mirror_path,
"sh", entry->d_name, nullptr); MIRRDIR "/system/bin/sh", entry->d_name, nullptr);
if (pid != -1) if (pid != -1)
waitpid(pid, nullptr, 0); waitpid(pid, nullptr, 0);
} }
@ -338,7 +338,7 @@ static void exec_module_script(const char* stage) {
LOGI("%s: exec [%s.sh]\n", module, stage); LOGI("%s: exec [%s.sh]\n", module, stage);
int pid = exec_command(false, nullptr, int pid = exec_command(false, nullptr,
strcmp(stage, "post-fs-data") ? set_path : set_mirror_path, strcmp(stage, "post-fs-data") ? set_path : set_mirror_path,
"sh", buf2, nullptr); MIRRDIR "/system/bin/sh", buf2, nullptr);
if (pid != -1) if (pid != -1)
waitpid(pid, nullptr, 0); waitpid(pid, nullptr, 0);
} }

View File

@ -211,8 +211,8 @@ int exec_array(bool err, int *fd, void (*pre_exec)(void), const char **argv) {
if (pre_exec) if (pre_exec)
pre_exec(); pre_exec();
execvp(argv[0], (char **) argv); execve(argv[0], (char **) argv, environ);
PLOGE("execvp %s", argv[0]); PLOGE("execve %s", argv[0]);
return -1; return -1;
} }