From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 04:59:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B304A465; Tue, 28 Oct 2014 04:59:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F6E7CF8; Tue, 28 Oct 2014 04:59:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9S4xYft013112; Tue, 28 Oct 2014 04:59:34 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9S4xYfA013111; Tue, 28 Oct 2014 04:59:34 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410280459.s9S4xYfA013111@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 28 Oct 2014 04:59:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273764 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 04:59:34 -0000 Author: mjg Date: Tue Oct 28 04:59:33 2014 New Revision: 273764 URL: https://svnweb.freebsd.org/changeset/base/273764 Log: Simplify sys_getloginclass. Just use current thread credentials as they have the same accuracy as the ones obtained from proc.. Modified: head/sys/kern/kern_loginclass.c Modified: head/sys/kern/kern_loginclass.c ============================================================================== --- head/sys/kern/kern_loginclass.c Tue Oct 28 04:33:57 2014 (r273763) +++ head/sys/kern/kern_loginclass.c Tue Oct 28 04:59:33 2014 (r273764) @@ -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)); } /*