Allow compilation on machines that do not have setrlimit.

This commit is contained in:
Ross Lagerwall 2012-02-25 07:36:49 +02:00
parent f7af1941b8
commit 1c4288f492
2 changed files with 10 additions and 1 deletions

View File

@ -206,6 +206,7 @@ AC_CHECK_HEADERS([ \
sys/mman.h \
sys/param.h \
sys/queue.h \
sys/resource.h \
sys/select.h \
sys/sendfile.h \
sys/socket.h \
@ -336,6 +337,7 @@ AC_CHECK_FUNCS([ \
putenv \
sendfile \
setenv \
setrlimit \
sigaction \
signal \
splice \

View File

@ -24,12 +24,17 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "event2/event-config.h"
#include <string.h>
#include <stdlib.h>
#ifdef _EVENT_HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef _EVENT_HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#include "event2/event-config.h"
#include "event2/event.h"
#include "event2/bufferevent.h"
#include "event2/listener.h"
@ -181,6 +186,7 @@ start_client(struct event_base *base)
int
main(int argc, char **argv)
{
#if !defined(_WIN32) && defined(_EVENT_HAVE_SETRLIMIT)
/* Set the fd limit to a low value so that any fd leak is caught without
making many requests. */
struct rlimit rl;
@ -189,6 +195,7 @@ main(int argc, char **argv)
perror("setrlimit");
exit(3);
}
#endif
/* Set up an address, used by both client & server. */
memset(&sin, 0, sizeof(sin));