return (0);
}
p = current_proc();
- /*
- * This use of proc_ucred() is safe because kernproc credential never
- * changes.
- */
- if (!IS_VALID_CRED(cred))
+ if (cred == NOCRED)
cred = proc_ucred(kernproc);
if (suser(cred, NULL) || proc_forcequota(p)) {
for (i = 0; i < MAXQUOTAS; i++) {
return (0);
}
p = current_proc();
- /*
- * This use of proc_ucred() is safe because kernproc credential never
- * changes.
- */
- if (!IS_VALID_CRED(cred))
+ if (cred == NOCRED)
cred = proc_ucred(kernproc);
if (suser(cred, NULL) || proc_forcequota(p)) {
for (i = 0; i < MAXQUOTAS; i++) {
if (error) {
(void) vnode_close(vp, FREAD|FWRITE, NULL);
- if (IS_VALID_CRED(qfp->qf_cred))
- kauth_cred_unref(&qfp->qf_cred);
+ kauth_cred_rele(qfp->qf_cred);
+ qfp->qf_cred = NOCRED;
qfp->qf_vp = NULLVP;
goto out;
}
struct hfsmount *hfsmp = VFSTOHFS(mp);
struct quotafile *qfp;
int error;
+ kauth_cred_t cred;
struct hfs_quotaoff_cargs args;
qfp = &hfsmp->hfs_qfiles[type];
error = vnode_close(qvp, FREAD|FWRITE, NULL);
qfp->qf_vp = NULLVP;
-
- if (IS_VALID_CRED(qfp->qf_cred))
- kauth_cred_unref(&qfp->qf_cred);
+ cred = qfp->qf_cred;
+ if (cred != NOCRED) {
+ qfp->qf_cred = NOCRED;
+ kauth_cred_rele(cred);
+ }
for (type = 0; type < MAXQUOTAS; type++)
if (hfsmp->hfs_qfiles[type].qf_vp != NULLVP)
break;