fix companion exec failed

This commit is contained in:
5ec1cff
2023-12-12 11:24:53 +08:00
parent b45d55e83d
commit 483987b7e6
2 changed files with 2 additions and 1 deletions

View File

@@ -243,7 +243,7 @@ static bool ensure_daemon_created(bool is_64bit) {
} else if (pid == 0) {
std::string daemon_name = "./bin/zygisk-cp";
daemon_name += is_64bit ? "64" : "32";
execl(daemon_name.c_str(), basename(daemon_name.c_str()), nullptr);
execl(daemon_name.c_str(), daemon_name.c_str(), nullptr);
PLOGE("exec daemon %s failed", daemon_name.c_str());
exit(1);
} else {

View File

@@ -156,6 +156,7 @@ fn create_daemon_socket() -> Result<UnixListener> {
fn spawn_companion(name: &str, lib_fd: RawFd) -> Result<Option<UnixStream>> {
let (mut daemon, companion) = UnixStream::pair()?;
// FIXME: avoid getting self path from arg0
let process = std::env::args().next().unwrap();
let nice_name = process.split('/').last().unwrap();