summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_loginclass.c
diff options
context:
space:
mode:
authormjg <mjg@FreeBSD.org>2014-10-28 04:59:33 +0000
committermjg <mjg@FreeBSD.org>2014-10-28 04:59:33 +0000
commitbf3b8650d66d62361b7e5690e6a7b7ee67f47a18 (patch)
tree3f7b8ebc899ada240baba921034ad74680438b16 /sys/kern/kern_loginclass.c
parent37841a11a2012b9696170e9eef78eef341e74dcf (diff)
downloadFreeBSD-src-bf3b8650d66d62361b7e5690e6a7b7ee67f47a18.zip
FreeBSD-src-bf3b8650d66d62361b7e5690e6a7b7ee67f47a18.tar.gz
Simplify sys_getloginclass.
Just use current thread credentials as they have the same accuracy as the ones obtained from proc..
Diffstat (limited to 'sys/kern/kern_loginclass.c')
-rw-r--r--sys/kern/kern_loginclass.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/sys/kern/kern_loginclass.c b/sys/kern/kern_loginclass.c
index 92eb3cf..c0946ef 100644
--- a/sys/kern/kern_loginclass.c
+++ b/sys/kern/kern_loginclass.c
@@ -178,24 +178,14 @@ struct getloginclass_args {
int
sys_getloginclass(struct thread *td, struct getloginclass_args *uap)
{
- int error = 0;
- size_t lcnamelen;
- struct proc *p;
struct loginclass *lc;
+ size_t lcnamelen;
- p = td->td_proc;
- PROC_LOCK(p);
- lc = p->p_ucred->cr_loginclass;
- loginclass_hold(lc);
- PROC_UNLOCK(p);
-
+ lc = td->td_ucred->cr_loginclass;
lcnamelen = strlen(lc->lc_name) + 1;
if (lcnamelen > uap->namelen)
- error = ERANGE;
- if (error == 0)
- error = copyout(lc->lc_name, uap->namebuf, lcnamelen);
- loginclass_free(lc);
- return (error);
+ return (ERANGE);
+ return (copyout(lc->lc_name, uap->namebuf, lcnamelen));
}
/*
OpenPOWER on IntegriCloud