You've already forked ReZygisk
mirror of
https://github.com/PerformanC/ReZygisk.git
synced 2025-09-06 06:37:01 +00:00
fix: wrong logic for detecting leaked fds; add: leaked fd warning
This commit fixes the logic issue which made leaked fds not be closed by "libzygisk.so", causing crashes for some. It also adds a warning for when it finds a leaked fd, so that module developers can be notified. fixes #163
This commit is contained in:
@@ -601,9 +601,11 @@ void ZygiskContext::sanitize_fds() {
|
||||
struct dirent *entry;
|
||||
while ((entry = readdir(dir))) {
|
||||
int fd = parse_int(entry->d_name);
|
||||
if (fd < 0 || fd < MAX_FD_SIZE || fd == dfd || allowed_fds[fd]) continue;
|
||||
if (fd < 0 || fd > MAX_FD_SIZE || fd == dfd || allowed_fds[fd]) continue;
|
||||
|
||||
close(fd);
|
||||
|
||||
LOGW("Closed leaked fd: %d", fd);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
Reference in New Issue
Block a user