[openssh-commits] [openssh] 02/02: Check for RLIMIT_NOFILE before trying to use it.
git+noreply at mindrot.org
git+noreply at mindrot.org
Mon Aug 2 19:31:15 AEST 2021
This is an automated email from the git hooks/post-receive script.
dtucker pushed a commit to branch master
in repository openssh.
commit 1e11fb24066f3fc259ee30db3dbb2a3127e05956
Author: Darren Tucker <dtucker at dtucker.net>
Date: Mon Aug 2 18:56:29 2021 +1000
Check for RLIMIT_NOFILE before trying to use it.
---
sftp-server.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sftp-server.c b/sftp-server.c
index 4972b2a6..c89c1f42 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -1491,13 +1491,13 @@ process_extended_limits(u_int32_t id)
struct sshbuf *msg;
int r;
uint64_t nfiles = 0;
-#ifdef HAVE_GETRLIMIT
+#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE)
struct rlimit rlim;
#endif
debug("request %u: limits", id);
-#ifdef HAVE_GETRLIMIT
+#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE)
if (getrlimit(RLIMIT_NOFILE, &rlim) != -1 && rlim.rlim_cur > 5)
nfiles = rlim.rlim_cur - 5; /* stdio(3) + syslog + spare */
#endif
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list