From owner-svn-src-head@freebsd.org Thu Jul 9 17:17:27 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7986F997967; Thu, 9 Jul 2015 17:17:27 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.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 4EDCC19A5; Thu, 9 Jul 2015 17:17:27 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t69HHRGs066586; Thu, 9 Jul 2015 17:17:27 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t69HHRQj066585; Thu, 9 Jul 2015 17:17:27 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201507091717.t69HHRQj066585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 9 Jul 2015 17:17:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285331 - 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.20 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: Thu, 09 Jul 2015 17:17:27 -0000 Author: mjg Date: Thu Jul 9 17:17:26 2015 New Revision: 285331 URL: https://svnweb.freebsd.org/changeset/base/285331 Log: vfs: cosmetic changes to namei and namei_handle_root - don't initialize cnp during declaration - don't test error/!error, compare to 0 instead Modified: head/sys/kern/vfs_lookup.c Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Thu Jul 9 17:17:22 2015 (r285330) +++ head/sys/kern/vfs_lookup.c Thu Jul 9 17:17:26 2015 (r285331) @@ -112,8 +112,9 @@ namei_cleanup_cnp(struct componentname * static int namei_handle_root(struct nameidata *ndp, struct vnode **dpp) { - struct componentname *cnp = &ndp->ni_cnd; + struct componentname *cnp; + cnp = &ndp->ni_cnd; if (ndp->ni_strictrelative != 0) { #ifdef KTRACE if (KTRPOINT(curthread, KTR_CAPFAIL)) @@ -194,7 +195,7 @@ namei(struct nameidata *ndp) /* * Don't allow empty pathnames. */ - if (!error && *cnp->cn_pnbuf == '\0') + if (error == 0 && *cnp->cn_pnbuf == '\0') error = ENOENT; #ifdef CAPABILITY_MODE @@ -215,7 +216,7 @@ namei(struct nameidata *ndp) } } #endif - if (error) { + if (error != 0) { namei_cleanup_cnp(cnp); ndp->ni_vp = NULL; return (error); @@ -301,7 +302,7 @@ namei(struct nameidata *ndp) for (;;) { ndp->ni_startdir = dp; error = lookup(ndp); - if (error) { + if (error != 0) { vrele(ndp->ni_rootdir); namei_cleanup_cnp(cnp); SDT_PROBE(vfs, namei, lookup, return, error, NULL, 0, @@ -330,7 +331,7 @@ namei(struct nameidata *ndp) if ((cnp->cn_flags & NOMACCHECK) == 0) { error = mac_vnode_check_readlink(td->td_ucred, ndp->ni_vp); - if (error) + if (error != 0) break; } #endif @@ -348,7 +349,7 @@ namei(struct nameidata *ndp) auio.uio_td = td; auio.uio_resid = MAXPATHLEN; error = VOP_READLINK(ndp->ni_vp, &auio, cnp->cn_cred); - if (error) { + if (error != 0) { if (ndp->ni_pathlen > 1) uma_zfree(namei_zone, cp); break;