diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 63b08325cb31..d4ff7b191247 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1341,8 +1341,10 @@ falloc(struct thread *td, struct file **resultfp, int *resultfd) fp = uma_zalloc(file_zone, M_WAITOK | M_ZERO); sx_xlock(&filelist_lock); - if ((openfiles >= maxuserfiles && (td->td_ucred->cr_ruid != 0 || - jailed(td->td_ucred))) || openfiles >= maxfiles) { + + if ((openfiles >= maxuserfiles && + suser_cred(td->td_ucred, SUSER_RUID) != 0) || + openfiles >= maxfiles) { if (ppsratecheck(&lastfail, &curfail, 1)) { printf("kern.maxfiles limit exceeded by uid %i, please see tuning(7).\n", td->td_ucred->cr_ruid);