When copying the poll() compatibility function from win32 to AROS
we need to update it to set nfds correctly.
While win32 does not care what nfds is set to and works even if nfds is always
0, other platforms, like AROS do care.
{
struct timeval timeout, *toptr;
fd_set ifds, ofds, efds, *ip, *op;
{
struct timeval timeout, *toptr;
fd_set ifds, ofds, efds, *ip, *op;
+ unsigned int i, maxfd = 0;
int rc;
// Set up the file-descriptor sets in ifds, ofds and efds.
int rc;
// Set up the file-descriptor sets in ifds, ofds and efds.
FD_SET(fds[i].fd, op);
}
FD_SET(fds[i].fd, &efds);
FD_SET(fds[i].fd, op);
}
FD_SET(fds[i].fd, &efds);
+ if (fds[i].fd > maxfd) {
+ maxfd = fds[i].fd;
+ }
}
// Set up the timeval structure for the timeout parameter
}
// Set up the timeval structure for the timeout parameter
timeout.tv_usec = (timo - timeout.tv_sec * 1000) * 1000;
}
timeout.tv_usec = (timo - timeout.tv_sec * 1000) * 1000;
}
- rc = WaitSelect(0, ip, op, &efds, toptr, NULL);
+ rc = WaitSelect(maxfd + 1, ip, op, &efds, toptr, NULL);