Check for RLIMIT_NOFILE before trying to use it.
This commit is contained in:
parent
0f494236b4
commit
1e11fb2406
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue