From 459d4a2cc5e6111860f2c6a86117a230d98dd4e9 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 6 May 1999 18:44:42 +0000 Subject: Fix up a few easy 'assignment used as truth value' and 'suggest parens around && within ||' type warnings. I'm pretty sure I have not masked any problems here, I've committed real problem fixes seperately. --- sys/i386/linux/linux_file.c | 5 +++-- sys/i386/linux/linux_ioctl.c | 5 +++-- sys/i386/linux/linux_misc.c | 20 +++++++++++++------- sys/i386/linux/linux_signal.c | 23 +++++++++++++++-------- sys/i386/linux/linux_stats.c | 14 +++++++++----- 5 files changed, 43 insertions(+), 24 deletions(-) (limited to 'sys/i386/linux') diff --git a/sys/i386/linux/linux_file.c b/sys/i386/linux/linux_file.c index 16f12ed..907e6b8 100644 --- a/sys/i386/linux/linux_file.c +++ b/sys/i386/linux/linux_file.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_file.c,v 1.22 1998/10/05 16:37:36 jfieber Exp $ + * $Id: linux_file.c,v 1.23 1999/01/10 23:15:35 eivind Exp $ */ #include "opt_compat.h" @@ -258,7 +258,8 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args) linux_to_bsd_flock(&linux_flock, bsd_flock); fcntl_args.cmd = F_GETLK; fcntl_args.arg = (int)bsd_flock; - if (error = fcntl(p, &fcntl_args)) + error = fcntl(p, &fcntl_args); + if (error) return error; bsd_to_linux_flock(bsd_flock, &linux_flock); return copyout((caddr_t)&linux_flock, (caddr_t)args->arg, diff --git a/sys/i386/linux/linux_ioctl.c b/sys/i386/linux/linux_ioctl.c index 9af33a9..3b4efd9 100644 --- a/sys/i386/linux/linux_ioctl.c +++ b/sys/i386/linux/linux_ioctl.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_ioctl.c,v 1.30 1998/11/12 00:42:08 jkh Exp $ + * $Id: linux_ioctl.c,v 1.31 1999/04/29 04:37:57 luoqi Exp $ */ #include @@ -732,7 +732,8 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args) case LINUX_TIOCGETD: bsd_line = TTYDISC; - if (error =(*func)(fp, TIOCSETD, (caddr_t)&bsd_line, p)) + error =(*func)(fp, TIOCSETD, (caddr_t)&bsd_line, p); + if (error) return error; switch (bsd_line) { case TTYDISC: diff --git a/sys/i386/linux/linux_misc.c b/sys/i386/linux/linux_misc.c index e01693a..9976e64 100644 --- a/sys/i386/linux/linux_misc.c +++ b/sys/i386/linux/linux_misc.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_misc.c,v 1.56 1999/04/27 12:21:04 phk Exp $ + * $Id: linux_misc.c,v 1.57 1999/04/28 01:04:19 luoqi Exp $ */ #include @@ -173,7 +173,8 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args) vp = NULL; NDINIT(&ni, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, args->library, p); - if (error = namei(&ni)) + error = namei(&ni); + if (error) goto cleanup; vp = ni.ni_vp; @@ -198,7 +199,8 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args) /* * Executable? */ - if (error = VOP_GETATTR(vp, &attr, p->p_ucred, p)) + error = VOP_GETATTR(vp, &attr, p->p_ucred, p); + if (error) goto cleanup; if ((vp->v_mount->mnt_flag & MNT_NOEXEC) || @@ -219,10 +221,12 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args) /* * Can we access it? */ - if (error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p)) + error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p); + if (error) goto cleanup; - if (error = VOP_OPEN(vp, FREAD, p->p_ucred, p)) + error = VOP_OPEN(vp, FREAD, p->p_ucred, p); + if (error) goto cleanup; /* @@ -772,12 +776,14 @@ linux_pipe(struct proc *p, struct linux_pipe_args *args) printf("Linux-emul(%d): pipe(*)\n", p->p_pid); #endif reg_edx = p->p_retval[1]; - if (error = pipe(p, 0)) { + error = pipe(p, 0); + if (error) { p->p_retval[1] = reg_edx; return error; } - if (error = copyout(p->p_retval, args->pipefds, 2*sizeof(int))) { + error = copyout(p->p_retval, args->pipefds, 2*sizeof(int)); + if (error) { p->p_retval[1] = reg_edx; return error; } diff --git a/sys/i386/linux/linux_signal.c b/sys/i386/linux/linux_signal.c index 1f71bf5..c8f0f21 100644 --- a/sys/i386/linux/linux_signal.c +++ b/sys/i386/linux/linux_signal.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_signal.c,v 1.13 1998/10/11 04:54:16 jdp Exp $ + * $Id: linux_signal.c,v 1.14 1998/12/21 19:21:36 sos Exp $ */ #include @@ -123,23 +123,28 @@ linux_sigaction(struct proc *p, struct linux_sigaction_args *args) if (args->nsa) { nsa = (struct sigaction *)stackgap_alloc(&sg, sizeof(struct sigaction)); - if (error = copyin(args->nsa, &linux_sa, sizeof(linux_sigaction_t))) + error = copyin(args->nsa, &linux_sa, sizeof(linux_sigaction_t)); + if (error) return error; linux_to_bsd_sigaction(&linux_sa, &bsd_sa); - if (error = copyout(&bsd_sa, nsa, sizeof(struct sigaction))) + error = copyout(&bsd_sa, nsa, sizeof(struct sigaction)); + if (error) return error; } sa.signum = linux_to_bsd_signal[args->sig]; sa.nsa = nsa; sa.osa = osa; - if ((error = sigaction(p, &sa))) + error = sigaction(p, &sa); + if (error) return error; if (args->osa) { - if (error = copyin(osa, &bsd_sa, sizeof(struct sigaction))) + error = copyin(osa, &bsd_sa, sizeof(struct sigaction)); + if (error) return error; bsd_to_linux_sigaction(&bsd_sa, &linux_sa); - if (error = copyout(&linux_sa, args->osa, sizeof(linux_sigaction_t))) + error = copyout(&linux_sa, args->osa, sizeof(linux_sigaction_t)); + if (error) return error; } return 0; @@ -199,12 +204,14 @@ linux_sigprocmask(struct proc *p, struct linux_sigprocmask_args *args) if (args->omask != NULL) { omask = bsd_to_linux_sigset(p->p_sigmask); - if (error = copyout(&omask, args->omask, sizeof(sigset_t))) + error = copyout(&omask, args->omask, sizeof(sigset_t)); + if (error) return error; } if (!(args->mask)) return 0; - if (error = copyin(args->mask, &mask, sizeof(linux_sigset_t))) + error = copyin(args->mask, &mask, sizeof(linux_sigset_t)); + if (error) return error; mask = linux_to_bsd_sigset(mask); diff --git a/sys/i386/linux/linux_stats.c b/sys/i386/linux/linux_stats.c index 3606e20..dc9090b 100644 --- a/sys/i386/linux/linux_stats.c +++ b/sys/i386/linux/linux_stats.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_stats.c,v 1.8 1997/02/22 09:38:25 peter Exp $ + * $Id: linux_stats.c,v 1.9 1997/11/06 19:29:04 phk Exp $ */ #include @@ -241,12 +241,14 @@ linux_statfs(struct proc *p, struct linux_statfs_args *args) #endif ndp = &nd; NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->path, curproc); - if (error = namei(ndp)) + error = namei(ndp); + if (error) return error; mp = ndp->ni_vp->v_mount; bsd_statfs = &mp->mnt_stat; vrele(ndp->ni_vp); - if (error = VFS_STATFS(mp, bsd_statfs, p)) + error = VFS_STATFS(mp, bsd_statfs, p); + if (error) return error; bsd_statfs->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; linux_statfs_buf.ftype = bsd_statfs->f_type; @@ -275,11 +277,13 @@ linux_fstatfs(struct proc *p, struct linux_fstatfs_args *args) #ifdef DEBUG printf("Linux-emul(%d): fstatfs(%d, *)\n", p->p_pid, args->fd); #endif - if (error = getvnode(p->p_fd, args->fd, &fp)) + error = getvnode(p->p_fd, args->fd, &fp); + if (error) return error; mp = ((struct vnode *)fp->f_data)->v_mount; bsd_statfs = &mp->mnt_stat; - if (error = VFS_STATFS(mp, bsd_statfs, p)) + error = VFS_STATFS(mp, bsd_statfs, p); + if (error) return error; bsd_statfs->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; linux_statfs_buf.ftype = bsd_statfs->f_type; -- cgit v1.1