- int ret;
-
- ret = kevent(kq, kqlst, kqoff, NULL, 0, &zero_timespec);
- /* jdc -- someone needs to do error checking... */
- if(ret == -1)
+ int ret, i;
+
+ /* Add them one at a time, because there may be
+ * already closed fds in it. The kernel will try
+ * to report invalid fds in the output; if there
+ * is no space, it silently stops processing the
+ * array at that point. We cannot give output space
+ * because that would also return events we cannot
+ * process at this point.
+ */
+ for(i = 0; i < kqoff; i++)