From: Dmitry Stogov Date: Mon, 26 Feb 2007 09:38:44 +0000 (+0000) Subject: poll() is not affected by FD_SETSIZE (Tony) X-Git-Tag: php-5.2.2RC1~269 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94d7b8b00498f861acc9d402bd33cebf2858beba;p=php poll() is not affected by FD_SETSIZE (Tony) --- diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c index 7bbabb1127..6e915804f1 100644 --- a/sapi/cgi/fastcgi.c +++ b/sapi/cgi/fastcgi.c @@ -764,22 +764,23 @@ int fcgi_accept_request(fcgi_request *req) break; #else if (req->fd >= 0) { - if (req->fd < FD_SETSIZE) { #if defined(HAVE_SYS_POLL_H) && defined(HAVE_POLL) - struct pollfd fds; - int ret; - - fds.fd = req->fd; - fds.events = POLLIN; - fds.revents = 0; - do { - errno = 0; - ret = poll(&fds, 1, 5000); - } while (ret < 0 && errno == EINTR); - if (ret > 0 && (fds.revents & POLLIN)) { - break; - } + struct pollfd fds; + int ret; + + fds.fd = req->fd; + fds.events = POLLIN; + fds.revents = 0; + do { + errno = 0; + ret = poll(&fds, 1, 5000); + } while (ret < 0 && errno == EINTR); + if (ret > 0 && (fds.revents & POLLIN)) { + break; + } + fcgi_close(req, 1, 0); #else + if (req->fd < FD_SETSIZE) { struct timeval tv = {5,0}; fd_set set; int ret; @@ -793,12 +794,12 @@ int fcgi_accept_request(fcgi_request *req) if (ret > 0 && FD_ISSET(req->fd, &set)) { break; } -#endif fcgi_close(req, 1, 0); } else { fprintf(stderr, "Too many open file descriptors. FD_SETSIZE limit exceeded."); fcgi_close(req, 1, 0); } +#endif } #endif }