Compress direct cr_ruid comparsion and jailed() call to suser_cred(9).

Reviewed by:	rwatson
This commit is contained in:
Pawel Jakub Dawidek 2006-06-27 11:32:08 +00:00
parent 8838c27693
commit 0bd645ae0c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159975

View File

@ -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);