summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-12 23:38:02 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-12 23:38:02 +0000
commitd83cca44c7050c3bccc2908f12b0db7aaefb7289 (patch)
treeb5174b0ac327c04112f1882132fc8263a13f8075 /libexec
parent8035f06849a068b72731292e08723fe99c213759 (diff)
rlimit handling code; aw@osn.de
Diffstat (limited to 'libexec')
-rw-r--r--libexec/spamd/spamd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libexec/spamd/spamd.c b/libexec/spamd/spamd.c
index 2f1175a5914..dac51bffa72 100644
--- a/libexec/spamd/spamd.c
+++ b/libexec/spamd/spamd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamd.c,v 1.30 2003/04/08 22:09:53 vincent Exp $ */
+/* $OpenBSD: spamd.c,v 1.31 2003/04/12 23:38:01 deraadt Exp $ */
/*
* Copyright (c) 2002 Theo de Raadt. All rights reserved.
@@ -28,6 +28,7 @@
#include <sys/file.h>
#include <sys/wait.h>
#include <sys/socket.h>
+#include <sys/resource.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -728,6 +729,7 @@ main(int argc, char *argv[])
int sinlen, one = 1;
u_short port, cfg_port;
struct servent *ent;
+ struct rlimit rlp;
tzset();
openlog_r("spamd", LOG_PID | LOG_NDELAY, LOG_DAEMON, &sdata);
@@ -775,6 +777,10 @@ main(int argc, char *argv[])
}
}
+ rlp.rlim_cur = rlp.rlim_max = maxcon + 7;
+ if (setrlimit(RLIMIT_NOFILE, &rlp) == -1)
+ err(1, "setrlimit");
+
con = calloc(maxcon, sizeof(*con));
if (con == NULL)
err(1, "calloc");