summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/sshd.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2012-04-11 13:26:41 +0000
committerDamien Miller <djm@cvs.openbsd.org>2012-04-11 13:26:41 +0000
commitd5290150086b92d9f526d7d6f699814291e74650 (patch)
tree776ace7fbde4fa0ad5c4037faef60a132982ccfd /usr.bin/ssh/sshd.c
parent8b069df63d5890aa4c09cababd813a3f73b72186 (diff)
don't spin in accept() when out of fds (ENFILE/ENFILE) - back off for a
while; ok deraadt@ markus@
Diffstat (limited to 'usr.bin/ssh/sshd.c')
-rw-r--r--usr.bin/ssh/sshd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c
index c1736f08d4e..6db8f7d5a17 100644
--- a/usr.bin/ssh/sshd.c
+++ b/usr.bin/ssh/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.388 2011/09/30 21:22:49 djm Exp $ */
+/* $OpenBSD: sshd.c,v 1.389 2012/04/11 13:26:40 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1142,7 +1142,10 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
(struct sockaddr *)&from, &fromlen);
if (*newsock < 0) {
if (errno != EINTR && errno != EWOULDBLOCK)
- error("accept: %.100s", strerror(errno));
+ error("accept: %.100s",
+ strerror(errno));
+ if (errno == EMFILE || errno == ENFILE)
+ usleep(100 * 1000);
continue;
}
if (unset_nonblock(*newsock) == -1) {