fix injector cannot get tmp path

This commit is contained in:
5ec1cff
2024-01-05 10:37:48 +08:00
parent 043cfd93d6
commit 9a95377d7b
6 changed files with 26 additions and 8 deletions

View File

@@ -136,7 +136,7 @@ struct SocketHandler : public EventHandler {
.sun_family = AF_UNIX,
.sun_path={0},
};
sprintf(addr.sun_path, "%s/%s", TMP_PATH, SOCKET_NAME);
sprintf(addr.sun_path, "%s/%s", zygiskd::GetTmpPath().c_str(), SOCKET_NAME);
socklen_t socklen = sizeof(sa_family_t) + strlen(addr.sun_path);
if (bind(sock_fd_, (struct sockaddr *) &addr, socklen) == -1) {
PLOGE("bind socket");
@@ -544,7 +544,7 @@ static void updateStatus() {
}
static bool prepare_environment() {
prop_path = std::string(TMP_PATH) + "/module.prop";
prop_path = zygiskd::GetTmpPath() + "/module.prop";
close(open(prop_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0644));
auto orig_prop = xopen_file("./module.prop", "r");
if (orig_prop == nullptr) {
@@ -595,7 +595,8 @@ void send_control_command(Command cmd) {
.sun_family = AF_UNIX,
.sun_path={0},
};
sprintf(addr.sun_path, "%s/%s", TMP_PATH, SOCKET_NAME);
zygiskd::Init(getenv("TMP_PATH"));
sprintf(addr.sun_path, "%s/%s", zygiskd::GetTmpPath().c_str(), SOCKET_NAME);
socklen_t socklen = sizeof(sa_family_t) + strlen(addr.sun_path);
auto nsend = sendto(sockfd, (void *) &cmd, sizeof(cmd), 0, (sockaddr *) &addr, socklen);
if (nsend == -1) {