+ if(errno == EBADF) {
+ /* If there's a bad FD in the mix then check them all and log what we
+ * find, to ease debugging */
+ for(mode = 0; mode < ev_nmodes; ++mode) {
+ for(n = 0; n < ev->mode[mode].nfds; ++n) {
+ const int fd = ev->mode[mode].fds[n].fd;
+
+ if(FD_ISSET(fd, &ev->mode[mode].enabled)
+ && fstat(fd, &sb) < 0)
+ error(errno, "fstat %d (%s)", fd, ev->mode[mode].fds[n].what);
+ }
+ }
+ }