summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_descrip.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-06-27 11:32:08 +0000
committerpjd <pjd@FreeBSD.org>2006-06-27 11:32:08 +0000
commit97382ba992b2246952e73a36460bcdfbb32f1c02 (patch)
treef284b8314fff45a6362b729da66026a85cf7653e /sys/kern/kern_descrip.c
parent9de1945c3f4b988dccedbd15d90918d76697e2ad (diff)
downloadFreeBSD-src-97382ba992b2246952e73a36460bcdfbb32f1c02.zip
FreeBSD-src-97382ba992b2246952e73a36460bcdfbb32f1c02.tar.gz
Compress direct cr_ruid comparsion and jailed() call to suser_cred(9).
Reviewed by: rwatson
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r--sys/kern/kern_descrip.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 63b0832..d4ff7b1 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);
OpenPOWER on IntegriCloud