summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2012-04-22 11:23:46 +1000
committerDamien Miller <djm@mindrot.org>2012-04-22 11:23:46 +1000
commita116d13c4daeb5416766bc506065eb495409977e (patch)
tree6e450a05768e75dc8f053183f8649f6dae14f000
parent9fed161e67b23977a1070419b356084295422f0c (diff)
- 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@
-rw-r--r--ChangeLog4
-rw-r--r--sshd.c7
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7cc59758..f5890757 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,10 @@
[auth.c]
Support "none" as an argument for AuthorizedPrincipalsFile to indicate
no file should be read.
+ - 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@
20120420
- (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec]
diff --git a/sshd.c b/sshd.c
index b63aaa42..fddbc9d3 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) {