diff options
author | claudio | 2018-10-19 08:13:34 +0000 |
---|---|---|
committer | Wynn Wolf Arbor | 2020-05-24 12:33:55 +0200 |
commit | 4872304086721d26e38796da0d65ee5d24a1ce3e (patch) | |
tree | 8cd5e9d84fe3b8e720135fb848ed27f4018eea2b /slowcgi.c | |
parent | bf949ae69e139767ee5bb4b518d99fdb93037dd2 (diff) | |
download | slowcgi-4872304086721d26e38796da0d65ee5d24a1ce3e.tar.gz |
When calculating the fd limit before accepting a new connection also account for the inflight fds caused by the new connection. Without this slowcgi could fail when close to the limit because FD_RESERVE is smaller then FD_NEEDED. OK florian@, tested by Kristaps Dzonsons
Diffstat (limited to 'slowcgi.c')
-rw-r--r-- | slowcgi.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: slowcgi.c,v 1.54 2018/08/19 12:31:41 florian Exp $ */ +/* $OpenBSD: slowcgi.c,v 1.55 2018/10/19 08:13:34 claudio Exp $ */ /* * Copyright (c) 2013 David Gwynne <dlg@openbsd.org> * Copyright (c) 2013 Florian Obser <florian@openbsd.org> @@ -437,7 +437,7 @@ accept_reserve(int sockfd, struct sockaddr *addr, socklen_t *addrlen, { int ret; if (getdtablecount() + reserve + - (*counter * FD_NEEDED) >= getdtablesize()) { + ((*counter + 1) * FD_NEEDED) >= getdtablesize()) { ldebug("inflight fds exceeded"); errno = EMFILE; return -1; |