Date: Wed, 22 Oct 2014 01:53:01 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273447 - head/sys/kern Message-ID: <201410220153.s9M1r14B031827@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410220153.s9M1r14B031827>