diff options
author | Darren Tucker <dtucker@dtucker.net> | 2021-08-02 10:56:29 +0200 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2021-08-02 10:56:29 +0200 |
commit | 1e11fb24066f3fc259ee30db3dbb2a3127e05956 (patch) | |
tree | b569c5f37c2010b0d683decece036dd1997bb592 /sftp-server.c | |
parent | lastenv is only used in setenv. (diff) | |
download | openssh-1e11fb24066f3fc259ee30db3dbb2a3127e05956.tar.xz openssh-1e11fb24066f3fc259ee30db3dbb2a3127e05956.zip |
Check for RLIMIT_NOFILE before trying to use it.
Diffstat (limited to 'sftp-server.c')
-rw-r--r-- | sftp-server.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sftp-server.c b/sftp-server.c index 4972b2a65..c89c1f424 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 |