Author: pjd Date: Thu Sep 5 00:19:30 2013 New Revision: 255222 URL: http://svnweb.freebsd.org/changeset/base/255222
Log: Style fixes. Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Thu Sep 5 00:17:38 2013 (r255221) +++ head/sys/kern/vfs_syscalls.c Thu Sep 5 00:19:30 2013 (r255222) @@ -181,8 +181,8 @@ sys_quotactl(td, uap) } */ *uap; { struct mount *mp; - int error; struct nameidata nd; + int error; AUDIT_ARG_CMD(uap->cmd); AUDIT_ARG_UID(uap->uid); @@ -198,7 +198,7 @@ sys_quotactl(td, uap) vput(nd.ni_vp); error = vfs_busy(mp, 0); vfs_rel(mp); - if (error) + if (error != 0) return (error); error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg); @@ -291,13 +291,13 @@ kern_statfs(struct thread *td, char *pat { struct mount *mp; struct statfs *sp, sb; - int error; struct nameidata nd; + int error; NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1, pathseg, path, td); error = namei(&nd); - if (error) + if (error != 0) return (error); mp = nd.ni_vp->v_mount; vfs_ref(mp); @@ -305,11 +305,11 @@ kern_statfs(struct thread *td, char *pat vput(nd.ni_vp); error = vfs_busy(mp, 0); vfs_rel(mp); - if (error) + if (error != 0) return (error); #ifdef MAC error = mac_mount_check_stat(td->td_ucred, mp); - if (error) + if (error != 0) goto out; #endif /* @@ -320,7 +320,7 @@ kern_statfs(struct thread *td, char *pat sp->f_namemax = NAME_MAX; sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; error = VFS_STATFS(mp, sp); - if (error) + if (error != 0) goto out; if (priv_check(td, PRIV_VFS_GENERATION)) { bcopy(sp, &sb, sizeof(sb)); @@ -373,7 +373,7 @@ kern_fstatfs(struct thread *td, int fd, AUDIT_ARG_FD(fd); error = getvnode(td->td_proc->p_fd, fd, cap_rights_init(&rights, CAP_FSTATFS), &fp); - if (error) + if (error != 0) return (error); vp = fp->f_vnode; vn_lock(vp, LK_SHARED | LK_RETRY); @@ -391,11 +391,11 @@ kern_fstatfs(struct thread *td, int fd, } error = vfs_busy(mp, 0); vfs_rel(mp); - if (error) + if (error != 0) return (error); #ifdef MAC error = mac_mount_check_stat(td->td_ucred, mp); - if (error) + if (error != 0) goto out; #endif /* @@ -406,7 +406,7 @@ kern_fstatfs(struct thread *td, int fd, sp->f_namemax = NAME_MAX; sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; error = VFS_STATFS(mp, sp); - if (error) + if (error != 0) goto out; if (priv_check(td, PRIV_VFS_GENERATION)) { bcopy(sp, &sb, sizeof(sb)); @@ -525,7 +525,7 @@ kern_getfsstat(struct thread *td, struct bcopy(sp, sfsp, sizeof(*sp)); else /* if (bufseg == UIO_USERSPACE) */ { error = copyout(sp, sfsp, sizeof(*sp)); - if (error) { + if (error != 0) { vfs_unbusy(mp); return (error); } @@ -570,7 +570,7 @@ freebsd4_statfs(td, uap) int error; error = kern_statfs(td, uap->path, UIO_USERSPACE, &sf); - if (error) + if (error != 0) return (error); cvtstatfs(&sf, &osb); return (copyout(&osb, uap->buf, sizeof(osb))); @@ -598,7 +598,7 @@ freebsd4_fstatfs(td, uap) int error; error = kern_fstatfs(td, uap->fd, &sf); - if (error) + if (error != 0) return (error); cvtstatfs(&sf, &osb); return (copyout(&osb, uap->buf, sizeof(osb))); @@ -669,10 +669,10 @@ freebsd4_fhstatfs(td, uap) int error; error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t)); - if (error) + if (error != 0) return (error); error = kern_fhstatfs(td, fh, &sf); - if (error) + if (error != 0) return (error); cvtstatfs(&sf, &osb); return (copyout(&osb, uap->buf, sizeof(osb))); @@ -751,12 +751,12 @@ sys_fchdir(td, uap) continue; error = VFS_ROOT(mp, LK_SHARED, &tdp); vfs_unbusy(mp); - if (error) + if (error != 0) break; vput(vp); vp = tdp; } - if (error) { + if (error != 0) { vput(vp); return (error); } @@ -792,9 +792,9 @@ int kern_chdir(struct thread *td, char *path, enum uio_seg pathseg) { register struct filedesc *fdp = td->td_proc->p_fd; - int error; struct nameidata nd; struct vnode *vp; + int error; NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1, pathseg, path, td); @@ -871,21 +871,23 @@ sys_chroot(td, uap) char *path; } */ *uap; { - int error; struct nameidata nd; + int error; error = priv_check(td, PRIV_VFS_CHROOT); - if (error) + if (error != 0) return (error); NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE, uap->path, td); error = namei(&nd); - if (error) + if (error != 0) goto error; - if ((error = change_dir(nd.ni_vp, td)) != 0) + error = change_dir(nd.ni_vp, td); + if (error != 0) goto e_vunlock; #ifdef MAC - if ((error = mac_vnode_check_chroot(td->td_ucred, nd.ni_vp))) + error = mac_vnode_check_chroot(td->td_ucred, nd.ni_vp); + if (error != 0) goto e_vunlock; #endif VOP_UNLOCK(nd.ni_vp, 0); @@ -909,18 +911,19 @@ change_dir(vp, td) struct vnode *vp; struct thread *td; { +#ifdef MAC int error; +#endif ASSERT_VOP_LOCKED(vp, "change_dir(): vp not locked"); if (vp->v_type != VDIR) return (ENOTDIR); #ifdef MAC error = mac_vnode_check_chdir(td->td_ucred, vp); - if (error) + if (error == 0) return (error); #endif - error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td); - return (error); + return (VOP_ACCESS(vp, VEXEC, td->td_ucred, td)); } /* @@ -942,7 +945,7 @@ change_root(vp, td) if (chroot_allow_open_directories == 0 || (chroot_allow_open_directories == 1 && fdp->fd_rdir != rootvnode)) { error = chroot_refuse_vdir_fds(fdp); - if (error) { + if (error != 0) { FILEDESC_XUNLOCK(fdp); return (error); } @@ -1050,10 +1053,11 @@ kern_openat(struct thread *td, int fd, c struct filedesc *fdp = p->p_fd; struct file *fp; struct vnode *vp; - int cmode; - int indx = -1, error; struct nameidata nd; cap_rights_t rights; + int cmode, error, indx; + + indx = -1; AUDIT_ARG_FFLAGS(flags); AUDIT_ARG_MODE(mode); @@ -1077,7 +1081,7 @@ kern_openat(struct thread *td, int fd, c * Allocate the file descriptor, but don't install a descriptor yet. */ error = falloc_noinstall(td, &fp); - if (error) + if (error != 0) return (error); /* * An extra reference on `fp' has been held for us by @@ -1085,12 +1089,12 @@ kern_openat(struct thread *td, int fd, c */ /* Set the flags early so the finit in devfs can pick them up. */ fp->f_flag = flags & FMASK; - cmode = ((mode &~ fdp->fd_cmask) & ALLPERMS) &~ S_ISTXT; + cmode = ((mode & ~fdp->fd_cmask) & ALLPERMS) & ~S_ISTXT; NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, fd, &rights, td); td->td_dupfd = -1; /* XXX check for fdopen */ error = vn_open(&nd, &flags, cmode, fp); - if (error) { + if (error != 0) { /* * If the vn_open replaced the method vector, something * wonderous happened deep below and we just pass it up @@ -1134,14 +1138,14 @@ kern_openat(struct thread *td, int fd, c if (fp->f_ops == &badfileops) { KASSERT(vp->v_type != VFIFO, ("Unexpected fifo.")); fp->f_seqcount = 1; - finit(fp, (flags & FMASK) | (fp->f_flag & FHASLOCK), DTYPE_VNODE, - vp, &vnops); + finit(fp, (flags & FMASK) | (fp->f_flag & FHASLOCK), + DTYPE_VNODE, vp, &vnops); } VOP_UNLOCK(vp, 0); if (flags & O_TRUNC) { error = fo_truncate(fp, 0, td->td_ucred, td); - if (error) + if (error != 0) goto bad; } success: @@ -1258,10 +1262,9 @@ kern_mknodat(struct thread *td, int fd, struct vnode *vp; struct mount *mp; struct vattr vattr; - int error; - int whiteout = 0; struct nameidata nd; cap_rights_t rights; + int error, whiteout = 0; AUDIT_ARG_MODE(mode); AUDIT_ARG_DEV(dev); @@ -1284,7 +1287,7 @@ kern_mknodat(struct thread *td, int fd, error = EINVAL; break; } - if (error) + if (error != 0) return (error); restart: bwillwrite(); @@ -1337,7 +1340,7 @@ restart: error = mac_vnode_check_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd, &vattr); #endif - if (!error) { + if (error == 0) { if (whiteout) error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, CREATE); else { @@ -1402,9 +1405,9 @@ kern_mkfifoat(struct thread *td, int fd, { struct mount *mp; struct vattr vattr; + struct nameidata nd; cap_rights_t rights; int error; - struct nameidata nd; AUDIT_ARG_MODE(mode); restart: @@ -1435,7 +1438,7 @@ restart: #ifdef MAC error = mac_vnode_check_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd, &vattr); - if (error) + if (error != 0) goto out; #endif error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr); @@ -1519,13 +1522,13 @@ can_hardlink(struct vnode *vp, struct uc if (hardlink_check_uid && cred->cr_uid != va.va_uid) { error = priv_check_cred(cred, PRIV_VFS_LINK, 0); - if (error) + if (error != 0) return (error); } if (hardlink_check_gid && !groupmember(va.va_gid, cred)) { error = priv_check_cred(cred, PRIV_VFS_LINK, 0); - if (error) + if (error != 0) return (error); } @@ -1644,8 +1647,8 @@ kern_symlinkat(struct thread *td, char * struct mount *mp; struct vattr vattr; char *syspath; - int error; struct nameidata nd; + int error; cap_rights_t rights; if (segflg == UIO_SYSSPACE) { @@ -1685,7 +1688,7 @@ restart: vattr.va_type = VLNK; error = mac_vnode_check_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd, &vattr); - if (error) + if (error != 0) goto out2; #endif error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, syspath); @@ -1713,16 +1716,16 @@ sys_undelete(td, uap) char *path; } */ *uap; { - int error; struct mount *mp; struct nameidata nd; + int error; restart: bwillwrite(); NDINIT(&nd, DELETE, LOCKPARENT | DOWHITEOUT | AUDITVNODE1, UIO_USERSPACE, uap->path, td); error = namei(&nd); - if (error) + if (error != 0) return (error); if (nd.ni_vp != NULLVP || !(nd.ni_cnd.cn_flags & ISWHITEOUT)) { @@ -1804,10 +1807,10 @@ kern_unlinkat(struct thread *td, int fd, { struct mount *mp; struct vnode *vp; - int error; struct nameidata nd; struct stat sb; cap_rights_t rights; + int error; restart: bwillwrite(); @@ -1847,7 +1850,7 @@ restart: #ifdef MAC error = mac_vnode_check_unlink(td->td_ucred, nd.ni_dvp, vp, &nd.ni_cnd); - if (error) + if (error != 0) goto out; #endif vfs_notify_upper(vp, VFS_NOTIFY_UPPER_UNLINK); @@ -1959,8 +1962,8 @@ vn_access(vp, user_flags, cred, td) struct ucred *cred; struct thread *td; { - int error; accmode_t accmode; + int error; /* Flags == 0 means only check for existence. */ error = 0; @@ -1974,7 +1977,7 @@ vn_access(vp, user_flags, cred, td) accmode |= VEXEC; #ifdef MAC error = mac_vnode_check_access(cred, vp, accmode); - if (error) + if (error != 0) return (error); #endif if ((accmode & VWRITE) == 0 || (error = vn_writechk(vp)) == 0) @@ -2121,11 +2124,10 @@ ostat(td, uap) int error; error = kern_stat(td, uap->path, UIO_USERSPACE, &sb); - if (error) + if (error != 0) return (error); cvtstat(&sb, &osb); - error = copyout(&osb, uap->ub, sizeof (osb)); - return (error); + return (copyout(&osb, uap->ub, sizeof (osb))); } /* @@ -2150,11 +2152,10 @@ olstat(td, uap) int error; error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb); - if (error) + if (error != 0) return (error); cvtstat(&sb, &osb); - error = copyout(&osb, uap->ub, sizeof (osb)); - return (error); + return (copyout(&osb, uap->ub, sizeof (osb))); } /* @@ -2269,7 +2270,7 @@ kern_statat_vnhook(struct thread *td, in if ((error = namei(&nd)) != 0) return (error); error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td); - if (!error) { + if (error == 0) { SDT_PROBE(vfs, , stat, mode, path, sb.st_mode, 0, 0, 0); if (S_ISREG(sb.st_mode)) SDT_PROBE(vfs, , stat, reg, path, pathseg, 0, 0, 0); @@ -2278,7 +2279,7 @@ kern_statat_vnhook(struct thread *td, in } NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_vp); - if (error) + if (error != 0) return (error); *sbp = sb; #ifdef KTRACE @@ -2330,6 +2331,7 @@ cvtnstat(sb, nsb) struct stat *sb; struct nstat *nsb; { + bzero(nsb, sizeof *nsb); nsb->st_dev = sb->st_dev; nsb->st_ino = sb->st_ino; @@ -2368,11 +2370,10 @@ sys_nstat(td, uap) int error; error = kern_stat(td, uap->path, UIO_USERSPACE, &sb); - if (error) + if (error != 0) return (error); cvtnstat(&sb, &nsb); - error = copyout(&nsb, uap->ub, sizeof (nsb)); - return (error); + return (copyout(&nsb, uap->ub, sizeof (nsb))); } /* @@ -2397,11 +2398,10 @@ sys_nlstat(td, uap) int error; error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb); - if (error) + if (error != 0) return (error); cvtnstat(&sb, &nsb); - error = copyout(&nsb, uap->ub, sizeof (nsb)); - return (error); + return (copyout(&nsb, uap->ub, sizeof (nsb))); } /* @@ -2521,8 +2521,8 @@ kern_readlinkat(struct thread *td, int f struct vnode *vp; struct iovec aiov; struct uio auio; - int error; struct nameidata nd; + int error; if (count > IOSIZE_MAX) return (EINVAL); @@ -2536,7 +2536,7 @@ kern_readlinkat(struct thread *td, int f vp = nd.ni_vp; #ifdef MAC error = mac_vnode_check_readlink(td->td_ucred, vp); - if (error) { + if (error != 0) { vput(vp); return (error); } @@ -2569,9 +2569,9 @@ setfflags(td, vp, flags) struct vnode *vp; u_long flags; { - int error; struct mount *mp; struct vattr vattr; + int error; /* We can't support the value matching VNOVAL. */ if (flags == VNOVAL) @@ -2585,7 +2585,7 @@ setfflags(td, vp, flags) */ if (vp->v_type == VCHR || vp->v_type == VBLK) { error = priv_check(td, PRIV_VFS_CHFLAGS_DEV); - if (error) + if (error != 0) return (error); } @@ -2738,9 +2738,9 @@ setfmode(td, cred, vp, mode) struct vnode *vp; int mode; { - int error; struct mount *mp; struct vattr vattr; + int error; if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) return (error); @@ -2833,10 +2833,9 @@ int kern_fchmodat(struct thread *td, int fd, char *path, enum uio_seg pathseg, mode_t mode, int flag) { - int error; struct nameidata nd; - int follow; cap_rights_t rights; + int error, follow; AUDIT_ARG_MODE(mode); follow = (flag & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : FOLLOW; @@ -2888,9 +2887,9 @@ setfown(td, cred, vp, uid, gid) uid_t uid; gid_t gid; { - int error; struct mount *mp; struct vattr vattr; + int error; if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) return (error); @@ -3093,9 +3092,9 @@ setutimes(td, vp, ts, numtimes, nullflag int numtimes; int nullflag; { - int error, setbirthtime; struct mount *mp; struct vattr vattr; + int error, setbirthtime; if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) return (error); @@ -3218,8 +3217,8 @@ kern_lutimes(struct thread *td, char *pa struct timeval *tptr, enum uio_seg tptrseg) { struct timespec ts[2]; - int error; struct nameidata nd; + int error; if ((error = getutimes(tptr, tptrseg, ts)) != 0) return (error); @@ -3263,7 +3262,8 @@ kern_futimes(struct thread *td, int fd, int error; AUDIT_ARG_FD(fd); - if ((error = getutimes(tptr, tptrseg, ts)) != 0) + error = getutimes(tptr, tptrseg, ts); + if (error != 0) return (error); error = getvnode(td->td_proc->p_fd, fd, cap_rights_init(&rights, CAP_FUTIMES), &fp); @@ -3423,7 +3423,8 @@ sys_fsync(td, uap) if (error != 0) return (error); vp = fp->f_vnode; - if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) + error = vn_start_write(vp, &mp, V_WAIT | PCATCH); + if (error != 0) goto drop; if (MNT_SHARED_WRITES(mp) || ((mp == NULL) && MNT_SHARED_WRITES(vp->v_mount))) { @@ -3584,15 +3585,15 @@ kern_renameat(struct thread *td, int old tond.ni_vp, fromnd.ni_dvp == tdvp, &tond.ni_cnd); #endif out: - if (!error) { + if (error == 0) { error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd, - tond.ni_dvp, tond.ni_vp, &tond.ni_cnd); + tond.ni_dvp, tond.ni_vp, &tond.ni_cnd); NDFREE(&fromnd, NDF_ONLY_PNBUF); NDFREE(&tond, NDF_ONLY_PNBUF); } else { NDFREE(&fromnd, NDF_ONLY_PNBUF); NDFREE(&tond, NDF_ONLY_PNBUF); - if (tvp) + if (tvp != NULL) vput(tvp); if (tdvp == tvp) vrele(tdvp); @@ -3660,9 +3661,9 @@ kern_mkdirat(struct thread *td, int fd, struct mount *mp; struct vnode *vp; struct vattr vattr; + struct nameidata nd; cap_rights_t rights; int error; - struct nameidata nd; AUDIT_ARG_MODE(mode); restart: @@ -3700,7 +3701,7 @@ restart: #ifdef MAC error = mac_vnode_check_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd, &vattr); - if (error) + if (error != 0) goto out; #endif error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr); @@ -3709,7 +3710,7 @@ out: #endif NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_dvp); - if (!error) + if (error == 0) vput(nd.ni_vp); vn_finished_write(mp); return (error); @@ -3746,9 +3747,9 @@ kern_rmdirat(struct thread *td, int fd, { struct mount *mp; struct vnode *vp; + struct nameidata nd; cap_rights_t rights; int error; - struct nameidata nd; restart: bwillwrite(); @@ -3778,7 +3779,7 @@ restart: #ifdef MAC error = mac_vnode_check_unlink(td->td_ucred, nd.ni_dvp, vp, &nd.ni_cnd); - if (error) + if (error != 0) goto out; #endif if (vn_start_write(nd.ni_dvp, &mp, V_NOWAIT) != 0) { @@ -3875,7 +3876,7 @@ unionread: loff = auio.uio_offset = foffset; #ifdef MAC error = mac_vnode_check_readdir(td->td_ucred, vp); - if (error) { + if (error != 0) { VOP_UNLOCK(vp, 0); foffset_unlock(fp, foffset, FOF_NOUPDATE); fdrop(fp, td); @@ -3933,7 +3934,7 @@ unionread: } free(dirbuf, M_TEMP); } - if (error) { + if (error != 0) { VOP_UNLOCK(vp, 0); foffset_unlock(fp, foffset, 0); fdrop(fp, td); @@ -3987,7 +3988,7 @@ sys_getdirentries(td, uap) error = kern_getdirentries(td, uap->fd, uap->buf, uap->count, &base, NULL, UIO_USERSPACE); - if (error) + if (error != 0) return (error); if (uap->basep != NULL) error = copyout(&base, uap->basep, sizeof(long)); @@ -4043,7 +4044,7 @@ unionread: error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, NULL, NULL); foffset = auio.uio_offset; - if (error) { + if (error != 0) { VOP_UNLOCK(vp, 0); goto fail; } @@ -4051,6 +4052,7 @@ unionread: (vp->v_vflag & VV_ROOT) && (vp->v_mount->mnt_flag & MNT_UNION)) { struct vnode *tvp = vp; + vp = vp->v_mount->mnt_vnodecovered; VREF(vp); fp->f_vnode = vp; @@ -4087,6 +4089,7 @@ sys_getdents(td, uap) } */ *uap; { struct getdirentries_args ap; + ap.fd = uap->fd; ap.buf = uap->buf; ap.count = uap->count; @@ -4137,8 +4140,8 @@ sys_revoke(td, uap) { struct vnode *vp; struct vattr vattr; - int error; struct nameidata nd; + int error; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE, uap->path, td); @@ -4152,15 +4155,15 @@ sys_revoke(td, uap) } #ifdef MAC error = mac_vnode_check_revoke(td->td_ucred, vp); - if (error) + if (error != 0) goto out; #endif error = VOP_GETATTR(vp, &vattr, td->td_ucred); - if (error) + if (error != 0) goto out; if (td->td_ucred->cr_uid != vattr.va_uid) { error = priv_check(td, PRIV_VFS_ADMIN); - if (error) + if (error != 0) goto out; } if (vcount(vp) > 1) @@ -4226,12 +4229,12 @@ sys_lgetfh(td, uap) int error; error = priv_check(td, PRIV_VFS_GETFH); - if (error) + if (error != 0) return (error); NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE, uap->fname, td); error = namei(&nd); - if (error) + if (error != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; @@ -4239,9 +4242,8 @@ sys_lgetfh(td, uap) fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid; error = VOP_VPTOFH(vp, &fh.fh_fid); vput(vp); - if (error) - return (error); - error = copyout(&fh, uap->fhp, sizeof (fh)); + if (error == 0) + error = copyout(&fh, uap->fhp, sizeof (fh)); return (error); } @@ -4262,12 +4264,12 @@ sys_getfh(td, uap) int error; error = priv_check(td, PRIV_VFS_GETFH); - if (error) + if (error != 0) return (error); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE, uap->fname, td); error = namei(&nd); - if (error) + if (error != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; @@ -4275,9 +4277,8 @@ sys_getfh(td, uap) fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid; error = VOP_VPTOFH(vp, &fh.fh_fid); vput(vp); - if (error) - return (error); - error = copyout(&fh, uap->fhp, sizeof (fh)); + if (error == 0) + error = copyout(&fh, uap->fhp, sizeof (fh)); return (error); } @@ -4310,7 +4311,7 @@ sys_fhopen(td, uap) int indx; error = priv_check(td, PRIV_VFS_FHOPEN); - if (error) + if (error != 0) return (error); indx = -1; fmode = FFLAGS(uap->flags); @@ -4318,7 +4319,7 @@ sys_fhopen(td, uap) if (((fmode & (FREAD | FWRITE)) == 0) || (fmode & O_CREAT)) return (EINVAL); error = copyin(uap->u_fhp, &fhp, sizeof(fhp)); - if (error) + if (error != 0) return(error); /* find the mount point */ mp = vfs_busyfs(&fhp.fh_fsid); @@ -4327,11 +4328,11 @@ sys_fhopen(td, uap) /* now give me my vnode, it gets returned to me locked */ error = VFS_FHTOVP(mp, &fhp.fh_fid, LK_EXCLUSIVE, &vp); vfs_unbusy(mp); - if (error) + if (error != 0) return (error); error = falloc_noinstall(td, &fp); - if (error) { + if (error != 0) { vput(vp); return (error); } @@ -4344,7 +4345,7 @@ sys_fhopen(td, uap) td->td_dupfd = -1; #endif error = vn_open_vnode(vp, fmode, td->td_ucred, td, fp); - if (error) { + if (error != 0) { KASSERT(fp->f_ops == &badfileops, ("VOP_OPEN in fhopen() set f_ops")); KASSERT(td->td_dupfd < 0, @@ -4361,9 +4362,9 @@ sys_fhopen(td, uap) finit(fp, (fmode & FMASK) | (fp->f_flag & FHASLOCK), DTYPE_VNODE, vp, &vnops); VOP_UNLOCK(vp, 0); - if (fmode & O_TRUNC) { + if ((fmode & O_TRUNC) != 0) { error = fo_truncate(fp, 0, td->td_ucred, td); - if (error) + if (error != 0) goto bad; } @@ -4399,9 +4400,8 @@ sys_fhstat(td, uap) if (error != 0) return (error); error = kern_fhstat(td, fh, &sb); - if (error != 0) - return (error); - error = copyout(&sb, uap->sb, sizeof(sb)); + if (error == 0) + error = copyout(&sb, uap->sb, sizeof(sb)); return (error); } @@ -4413,13 +4413,13 @@ kern_fhstat(struct thread *td, struct fh int error; error = priv_check(td, PRIV_VFS_FHSTAT); - if (error) + if (error != 0) return (error); if ((mp = vfs_busyfs(&fh.fh_fsid)) == NULL) return (ESTALE); error = VFS_FHTOVP(mp, &fh.fh_fid, LK_EXCLUSIVE, &vp); vfs_unbusy(mp); - if (error) + if (error != 0) return (error); error = vn_stat(vp, sb, td->td_ucred, NOCRED, td); vput(vp); @@ -4448,10 +4448,10 @@ sys_fhstatfs(td, uap) int error; error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t)); - if (error) + if (error != 0) return (error); error = kern_fhstatfs(td, fh, &sf); - if (error) + if (error != 0) return (error); return (copyout(&sf, uap->buf, sizeof(sf))); } @@ -4465,22 +4465,22 @@ kern_fhstatfs(struct thread *td, fhandle int error; error = priv_check(td, PRIV_VFS_FHSTATFS); - if (error) + if (error != 0) return (error); if ((mp = vfs_busyfs(&fh.fh_fsid)) == NULL) return (ESTALE); error = VFS_FHTOVP(mp, &fh.fh_fid, LK_EXCLUSIVE, &vp); - if (error) { + if (error != 0) { vfs_unbusy(mp); return (error); } vput(vp); error = prison_canseemount(td->td_ucred, mp); - if (error) + if (error != 0) goto out; #ifdef MAC error = mac_mount_check_stat(td->td_ucred, mp); - if (error) + if (error != 0) goto out; #endif /* _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"