From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 01:53:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C7C1A5C7; Wed, 22 Oct 2014 01:53:01 +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 B4014E13; Wed, 22 Oct 2014 01:53:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M1r1X9031828; Wed, 22 Oct 2014 01:53:01 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M1r14B031827; Wed, 22 Oct 2014 01:53:01 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410220153.s9M1r14B031827@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 22 Oct 2014 01:53:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273447 - 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: Wed, 22 Oct 2014 01:53:01 -0000 Author: mjg Date: Wed Oct 22 01:53:00 2014 New Revision: 273447 URL: https://svnweb.freebsd.org/changeset/base/273447 Log: Reduce nesting in vn_access. No functional changes. Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Oct 22 01:37:32 2014 (r273446) +++ head/sys/kern/vfs_syscalls.c Wed Oct 22 01:53:00 2014 (r273447) @@ -1994,23 +1994,23 @@ vn_access(vp, user_flags, cred, td) int error; /* Flags == 0 means only check for existence. */ - error = 0; - if (user_flags) { - accmode = 0; - if (user_flags & R_OK) - accmode |= VREAD; - if (user_flags & W_OK) - accmode |= VWRITE; - if (user_flags & X_OK) - accmode |= VEXEC; + if (user_flags == 0) + return (0); + + accmode = 0; + if (user_flags & R_OK) + accmode |= VREAD; + if (user_flags & W_OK) + accmode |= VWRITE; + if (user_flags & X_OK) + accmode |= VEXEC; #ifdef MAC - error = mac_vnode_check_access(cred, vp, accmode); - if (error != 0) - return (error); + error = mac_vnode_check_access(cred, vp, accmode); + if (error != 0) + return (error); #endif - if ((accmode & VWRITE) == 0 || (error = vn_writechk(vp)) == 0) - error = VOP_ACCESS(vp, accmode, cred, td); - } + if ((accmode & VWRITE) == 0 || (error = vn_writechk(vp)) == 0) + error = VOP_ACCESS(vp, accmode, cred, td); return (error); }