summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/queue.c
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-12-13 22:02:56 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-12-13 22:02:56 +0000
commita667cad6a34b7efa8b53891858ff5c77800b7813 (patch)
tree133d5ec6b4b43d4bf170a366fe97fea488aea75c /usr.sbin/smtpd/queue.c
parentfcdbb6f81071cffc3aed63cc4af0907fcd70ebef (diff)
Use safe fd limits in smtp, lka, queue, and control. Removes a
possibility for fd-starvation fatal when under heavy load.
Diffstat (limited to 'usr.sbin/smtpd/queue.c')
-rw-r--r--usr.sbin/smtpd/queue.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c
index c9074ea3b6e..d43164ac4c4 100644
--- a/usr.sbin/smtpd/queue.c
+++ b/usr.sbin/smtpd/queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue.c,v 1.73 2009/11/08 21:40:05 gilles Exp $ */
+/* $OpenBSD: queue.c,v 1.74 2009/12/13 22:02:55 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -579,6 +579,13 @@ queue(struct smtpd *env)
signal(SIGPIPE, SIG_IGN);
signal(SIGHUP, SIG_IGN);
+ /*
+ * queue opens fds for four purposes: smtp, mta, mda, and bounces.
+ * Therefore, double the fdlimit the second time to achieve a 4x
+ * increase relative to default.
+ */
+ fdlimit(getdtablesize() * 2);
+
config_pipes(env, peers, nitems(peers));
config_peers(env, peers, nitems(peers));