mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Close stub fd
This commit is contained in:
parent
e1987c42c4
commit
f97866a961
@ -375,15 +375,18 @@ void boot_complete(int client) {
|
|||||||
if (access(SECURE_DIR, F_OK) != 0)
|
if (access(SECURE_DIR, F_OK) != 0)
|
||||||
xmkdir(SECURE_DIR, 0700);
|
xmkdir(SECURE_DIR, 0700);
|
||||||
|
|
||||||
if (stub_fd > 0 && !get_manager()) {
|
if (stub_fd > 0) {
|
||||||
// Install stub
|
if (!get_manager()) {
|
||||||
struct stat st{};
|
// Install stub
|
||||||
fstat(stub_fd, &st);
|
struct stat st{};
|
||||||
int dfd = xopen("/data/stub.apk", O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0600);
|
fstat(stub_fd, &st);
|
||||||
xsendfile(dfd, stub_fd, nullptr, st.st_size);
|
char apk[] = "/data/stub.apk";
|
||||||
|
int dfd = xopen(apk, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0600);
|
||||||
|
xsendfile(dfd, stub_fd, nullptr, st.st_size);
|
||||||
|
close(dfd);
|
||||||
|
install_apk(apk);
|
||||||
|
}
|
||||||
close(stub_fd);
|
close(stub_fd);
|
||||||
close(dfd);
|
|
||||||
stub_fd = -1;
|
stub_fd = -1;
|
||||||
install_apk("/data/stub.apk");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user