diff options
Diffstat (limited to 'sys/kern/sys_generic.c')
-rw-r--r-- | sys/kern/sys_generic.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index e725f8f..7ba4f26 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -961,11 +961,14 @@ poll(td, uap) * least enough for the current limits. We want to be reasonably * safe, but not overly restrictive. */ - if ((nfds > td->td_proc->p_rlimit[RLIMIT_NOFILE].rlim_cur) && + PROC_LOCK(td->td_proc); + if ((nfds > lim_cur(td->td_proc, RLIMIT_NOFILE)) && (nfds > FD_SETSIZE)) { + PROC_UNLOCK(td->td_proc); error = EINVAL; goto done2; } + PROC_UNLOCK(td->td_proc); ni = nfds * sizeof(struct pollfd); if (ni > sizeof(smallbits)) bits = malloc(ni, M_TEMP, M_WAITOK); |