Use execve directly

This commit is contained in:
topjohnwu 2024-02-24 01:47:11 -08:00
parent 39dbffadfe
commit db99caf258
3 changed files with 3 additions and 2 deletions

View File

@ -65,6 +65,7 @@ EXPORT_SYMBOL(fchmodat);
EXPORT_SYMBOL(fchownat); EXPORT_SYMBOL(fchownat);
EXPORT_SYMBOL(readv); EXPORT_SYMBOL(readv);
EXPORT_SYMBOL(lseek); EXPORT_SYMBOL(lseek);
EXPORT_SYMBOL(execve);
SYMBOL_ALIAS(exit, _exit); SYMBOL_ALIAS(exit, _exit);

View File

@ -243,7 +243,7 @@ void BaseInit::exec_init() {
if (xumount2(p.data(), MNT_DETACH) == 0) if (xumount2(p.data(), MNT_DETACH) == 0)
LOGD("Unmount [%s]\n", p.data()); LOGD("Unmount [%s]\n", p.data());
} }
execv("/init", argv); execve("/init", argv, environ);
exit(1); exit(1);
} }

View File

@ -403,6 +403,6 @@ int magisk_proxy_main(int argc, char *argv[]) {
// Tell magiskd to remount rootfs // Tell magiskd to remount rootfs
setenv("REMOUNT_ROOT", "1", 1); setenv("REMOUNT_ROOT", "1", 1);
execv("/sbin/magisk", argv); execve("/sbin/magisk", argv, environ);
return 1; return 1;
} }