summaryrefslogtreecommitdiffstats
path: root/sshd.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2012-04-22 03:23:46 +0200
committerDamien Miller <djm@mindrot.org>2012-04-22 03:23:46 +0200
commita116d13c4daeb5416766bc506065eb495409977e (patch)
tree6e450a05768e75dc8f053183f8649f6dae14f000 /sshd.c
parent - djm@cvs.openbsd.org 2012/04/11 13:17:54 (diff)
downloadopenssh-a116d13c4daeb5416766bc506065eb495409977e.tar.xz
openssh-a116d13c4daeb5416766bc506065eb495409977e.zip
- djm@cvs.openbsd.org 2012/04/11 13:26:40
[sshd.c] don't spin in accept() when out of fds (ENFILE/ENFILE) - back off for a while; ok deraadt@ markus@
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sshd.c b/sshd.c
index b63aaa428..fddbc9d37 100644
--- a/sshd.c
+++ b/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
@@ -1174,7 +1174,10 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
if (*newsock < 0) {
if (errno != EINTR && errno != EAGAIN &&
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) {