diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2015-07-09 17:17:26 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2015-07-09 17:17:26 +0000 |
commit | 318b94632120d70b36c72a6e0004ee814befdc02 (patch) | |
tree | d274c96938546e512a4befc83f4aa49beb34f0ad /sys/kern/vfs_lookup.c | |
parent | 45c1772ea0e3d87c882c93c895534314998ce551 (diff) | |
download | src-318b94632120d70b36c72a6e0004ee814befdc02.tar.gz src-318b94632120d70b36c72a6e0004ee814befdc02.zip |
vfs: cosmetic changes to namei and namei_handle_root
- don't initialize cnp during declaration
- don't test error/!error, compare to 0 instead
Notes
Notes:
svn path=/head/; revision=285331
Diffstat (limited to 'sys/kern/vfs_lookup.c')
-rw-r--r-- | sys/kern/vfs_lookup.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index a93314e88e6c..1d3bc3598285 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -112,8 +112,9 @@ namei_cleanup_cnp(struct componentname *cnp) 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; |