diff --git a/utilities/xmlrpcpp/src/XmlRpcServer.cpp b/utilities/xmlrpcpp/src/XmlRpcServer.cpp index 99aa24d2f0..28bcf70cd1 100644 --- a/utilities/xmlrpcpp/src/XmlRpcServer.cpp +++ b/utilities/xmlrpcpp/src/XmlRpcServer.cpp @@ -30,26 +30,6 @@ XmlRpcServer::XmlRpcServer() _accept_error(false), _accept_retry_time_sec(0.0) { -#if !defined(_WINDOWS) - struct rlimit limit = { .rlim_cur = 0, .rlim_max = 0 }; - unsigned int max_files = 1024; - - if(getrlimit(RLIMIT_NOFILE, &limit) == 0) { - max_files = limit.rlim_max; - if( limit.rlim_max == RLIM_INFINITY ) { - max_files = 0; - } - } else { - XmlRpcUtil::error("Could not get open file limit: %s", strerror(errno)); - } - pollfds.resize(max_files); - for(unsigned int i=0; i= 0) { - for(rlim_t i=0; i FREE_FD_BUFFER ? FREE_FD_BUFFER : limit.rlim_cur); + + // Poll the available file descriptors. + // The POSIX specification guarantees that rlim_cur will always be less or + // equal to the process's initial rlim_max, so we don't need an additional + // bounds check here. + for(unsigned long long offset=0; offset= 0) { + for(rlim_t i=0; i