summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openbsd-compat/bsd-closefrom.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/openbsd-compat/bsd-closefrom.c b/openbsd-compat/bsd-closefrom.c
index 8b9a56278..8fadca2da 100644
--- a/openbsd-compat/bsd-closefrom.c
+++ b/openbsd-compat/bsd-closefrom.c
@@ -107,9 +107,9 @@ closefrom(int lowfd)
107 if ((fdinfo_buf = malloc(sz)) == NULL) 107 if ((fdinfo_buf = malloc(sz)) == NULL)
108 goto fallback; 108 goto fallback;
109 r = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, fdinfo_buf, sz); 109 r = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, fdinfo_buf, sz);
110 if (r < 0 || r >= sz) 110 if (r < 0 || r > sz)
111 goto fallback; 111 goto fallback;
112 for (i = 0; i < sz / (int)PROC_PIDLISTFD_SIZE; i++) { 112 for (i = 0; i < r / (int)PROC_PIDLISTFD_SIZE; i++) {
113 if (fdinfo_buf[i].proc_fd >= lowfd) 113 if (fdinfo_buf[i].proc_fd >= lowfd)
114 close(fdinfo_buf[i].proc_fd); 114 close(fdinfo_buf[i].proc_fd);
115 } 115 }