From 0bd645ae0cc773aac5ddadd050698eb4f74de2d7 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Tue, 27 Jun 2006 11:32:08 +0000 Subject: [PATCH] Compress direct cr_ruid comparsion and jailed() call to suser_cred(9). Reviewed by: rwatson --- sys/kern/kern_descrip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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);