From: Ronnie Sahlberg Date: Sat, 13 Apr 2013 10:39:12 +0000 (-0700) Subject: AROS: We have to provide the correct nfds to WaitSelect X-Git-Tag: upstream/1.9.6^2~226 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a7954132ce64cabdb7b22a2b50fe36469518e89c;p=deb_libnfs.git AROS: We have to provide the correct nfds to WaitSelect 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. --- diff --git a/aros/aros_compat.c b/aros/aros_compat.c index 955f8e3..6e484f4 100644 --- a/aros/aros_compat.c +++ b/aros/aros_compat.c @@ -89,7 +89,7 @@ int aros_poll(struct pollfd *fds, unsigned int nfds, int timo) { struct timeval timeout, *toptr; fd_set ifds, ofds, efds, *ip, *op; - unsigned int i; + unsigned int i, maxfd = 0; int rc; // Set up the file-descriptor sets in ifds, ofds and efds. @@ -110,6 +110,9 @@ int aros_poll(struct pollfd *fds, unsigned int nfds, int timo) 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 @@ -124,7 +127,7 @@ int aros_poll(struct pollfd *fds, unsigned int nfds, int timo) 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); if(rc <= 0) return rc;