mirror of
git://anongit.mindrot.org/openssh.git
synced 2025-01-11 12:09:32 +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)
|
if ((fdinfo_buf = malloc(sz)) == NULL)
|
||||||
goto fallback;
|
goto fallback;
|
||||||
r = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, fdinfo_buf, sz);
|
r = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, fdinfo_buf, sz);
|
||||||
if (r < 0 || r >= sz)
|
if (r < 0 || r > sz)
|
||||||
goto fallback;
|
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)
|
if (fdinfo_buf[i].proc_fd >= lowfd)
|
||||||
close(fdinfo_buf[i].proc_fd);
|
close(fdinfo_buf[i].proc_fd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user