mirror of
git://anongit.mindrot.org/openssh.git
synced 2024-12-24 10:52:05 +00:00
fixed test in OSX closefrom() replacement
from likan_999.student AT sina.com
This commit is contained in:
parent
6b7c53498d
commit
368f1cc2fb
@ -107,9 +107,9 @@ closefrom(int lowfd)
|
||||
if ((fdinfo_buf = malloc(sz)) == NULL)
|
||||
goto fallback;
|
||||
r = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, fdinfo_buf, sz);
|
||||
if (r < 0 || r >= sz)
|
||||
if (r < 0 || r > sz)
|
||||
goto fallback;
|
||||
for (i = 0; i < sz / (int)PROC_PIDLISTFD_SIZE; i++) {
|
||||
for (i = 0; i < r / (int)PROC_PIDLISTFD_SIZE; i++) {
|
||||
if (fdinfo_buf[i].proc_fd >= lowfd)
|
||||
close(fdinfo_buf[i].proc_fd);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user