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.
This commit is contained in:
peter 1999-05-06 18:44:42 +00:00
parent 76fe48ca4c
commit 36880de539
29 changed files with 173 additions and 114 deletions

View File

@ -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,

View File

@ -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 <sys/param.h>
@ -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:

View File

@ -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 <sys/param.h>
@ -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;
}

View File

@ -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 <sys/param.h>
@ -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);

View File

@ -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 <sys/param.h>
@ -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;

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_lnc.c,v 1.57 1999/04/18 01:49:16 paul Exp $
* $Id: if_lnc.c,v 1.58 1999/05/06 18:12:26 peter Exp $
*/
/*
@ -2032,7 +2032,7 @@ mbuf_dump_chain(struct mbuf * m)
m->M_dat.MH.MH_dat.MH_ext.ext_size);
}
}
} while (m = m->m_next);
} while ((m = m->m_next) != NULL);
}
#endif

View File

@ -40,7 +40,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: mcd.c,v 1.101 1998/10/22 05:58:39 bde Exp $
* $Id: mcd.c,v 1.102 1999/04/28 10:52:41 dt Exp $
*/
static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@ -1502,8 +1502,8 @@ mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te)
if ( te->data_len < sizeof(entries[0])
|| (te->data_len % sizeof(entries[0])) != 0
|| te->address_format != CD_MSF_FORMAT
&& te->address_format != CD_LBA_FORMAT
|| (te->address_format != CD_MSF_FORMAT
&& te->address_format != CD_LBA_FORMAT)
)
return EINVAL;

View File

@ -11,7 +11,7 @@
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* $Id: mse.c,v 1.40 1999/04/28 10:52:43 dt Exp $
* $Id: mse.c,v 1.41 1999/05/06 18:12:28 peter Exp $
*/
/*
* Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
@ -357,8 +357,9 @@ mseread(dev, uio, ioflag)
return (0);
}
sc->sc_flags |= MSESC_WANT;
if (error = tsleep((caddr_t)sc, MSEPRI | PCATCH,
"mseread", 0)) {
error = tsleep((caddr_t)sc, MSEPRI | PCATCH,
"mseread", 0);
if (error) {
splx(s);
return (error);
}
@ -391,7 +392,8 @@ mseread(dev, uio, ioflag)
}
splx(s);
xfer = min(uio->uio_resid, sc->mode.packetsize - sc->sc_bytesread);
if (error = uiomove(&sc->sc_bytes[sc->sc_bytesread], xfer, uio))
error = uiomove(&sc->sc_bytes[sc->sc_bytesread], xfer, uio);
if (error)
return (error);
sc->sc_bytesread += xfer;
return(0);

View File

@ -760,8 +760,9 @@ rcopen(dev, flag, mode, p)
error = EBUSY;
goto out;
}
if (error = tsleep(&rc->rc_rcb,
TTIPRI|PCATCH, "rcbi", 0))
error = tsleep(&rc->rc_rcb,
TTIPRI|PCATCH, "rcbi", 0);
if (error)
goto out;
goto again;
}

View File

@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: rp.c,v 1.23 1999/04/24 20:26:12 billf Exp $
* $Id: rp.c,v 1.24 1999/04/27 11:15:12 phk Exp $
*/
/*
@ -1555,10 +1555,9 @@ rpwrite(dev, uio, flag)
tp = rp->rp_tty;
while(rp->rp_disable_writes) {
rp->rp_waiting = 1;
if(error = ttysleep(tp, (caddr_t)rp, TTOPRI|PCATCH,
"rp_write", 0)) {
error = ttysleep(tp, (caddr_t)rp, TTOPRI|PCATCH, "rp_write", 0);
if (error)
return(error);
}
}
error = (*linesw[tp->t_line].l_write)(tp, uio, flag);
@ -1661,7 +1660,7 @@ rpioctl(dev, cmd, data, flag, p)
dt->c_lflag = (tp->t_lflag & lt->c_lflag)
| (dt->c_lflag & ~lt->c_lflag);
for(cc = 0; cc < NCCS; ++cc)
if(lt->c_cc[cc] = tp->t_cc[cc])
if((lt->c_cc[cc] = tp->t_cc[cc]) != 0)
dt->c_cc[cc] = tp->t_cc[cc];
if(lt->c_ispeed != 0)
dt->c_ispeed = tp->t_ispeed;

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: sio.c,v 1.227 1999/04/24 10:41:21 dt Exp $
* $Id: sio.c,v 1.228 1999/04/27 11:15:42 phk Exp $
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
* from: i386/isa sio.c,v 1.234
*/
@ -1395,9 +1395,9 @@ comhardclose(com)
* the next open because it might go up and down while
* we're not watching.
*/
|| !com->active_out
&& !(com->prev_modem_status & MSR_DCD)
&& !(com->it_in.c_cflag & CLOCAL)
|| (!com->active_out
&& !(com->prev_modem_status & MSR_DCD)
&& !(com->it_in.c_cflag & CLOCAL))
|| !(tp->t_state & TS_ISOPEN)) {
(void)commctl(com, TIOCM_DTR, DMBIC);
if (com->dtr_wait != 0 && !(com->state & CS_DTR_OFF)) {
@ -2074,7 +2074,7 @@ comparam(tp, t)
/* check requested parameters */
divisor = ttspeedtab(t->c_ospeed, comspeedtab);
if (divisor < 0 || divisor > 0 && t->c_ispeed != t->c_ospeed)
if (divisor < 0 || (divisor > 0 && t->c_ispeed != t->c_ospeed))
return (EINVAL);
/* parameters are OK, convert them to the com struct and the device */

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_lnc.c,v 1.57 1999/04/18 01:49:16 paul Exp $
* $Id: if_lnc.c,v 1.58 1999/05/06 18:12:26 peter Exp $
*/
/*
@ -2032,7 +2032,7 @@ mbuf_dump_chain(struct mbuf * m)
m->M_dat.MH.MH_dat.MH_ext.ext_size);
}
}
} while (m = m->m_next);
} while ((m = m->m_next) != NULL);
}
#endif

View File

@ -47,7 +47,7 @@
*/
/*
* $Id: if_ze.c,v 1.56 1998/12/07 21:58:21 archie Exp $
* $Id: if_ze.c,v 1.57 1999/05/06 18:12:27 peter Exp $
*/
/* XXX don't mix different PCCARD support code. */
@ -1167,7 +1167,7 @@ zeintr(unit)
/*
* loop until there are no more new interrupts
*/
while (isr = inb(sc->nic_addr + ED_P0_ISR)) {
while ((isr = inb(sc->nic_addr + ED_P0_ISR)) != 0) {
/*
* reset all the bits that we are 'acknowleging'

View File

@ -40,7 +40,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: mcd.c,v 1.101 1998/10/22 05:58:39 bde Exp $
* $Id: mcd.c,v 1.102 1999/04/28 10:52:41 dt Exp $
*/
static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@ -1502,8 +1502,8 @@ mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te)
if ( te->data_len < sizeof(entries[0])
|| (te->data_len % sizeof(entries[0])) != 0
|| te->address_format != CD_MSF_FORMAT
&& te->address_format != CD_LBA_FORMAT
|| (te->address_format != CD_MSF_FORMAT
&& te->address_format != CD_LBA_FORMAT)
)
return EINVAL;

View File

@ -11,7 +11,7 @@
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* $Id: mse.c,v 1.40 1999/04/28 10:52:43 dt Exp $
* $Id: mse.c,v 1.41 1999/05/06 18:12:28 peter Exp $
*/
/*
* Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
@ -357,8 +357,9 @@ mseread(dev, uio, ioflag)
return (0);
}
sc->sc_flags |= MSESC_WANT;
if (error = tsleep((caddr_t)sc, MSEPRI | PCATCH,
"mseread", 0)) {
error = tsleep((caddr_t)sc, MSEPRI | PCATCH,
"mseread", 0);
if (error) {
splx(s);
return (error);
}
@ -391,7 +392,8 @@ mseread(dev, uio, ioflag)
}
splx(s);
xfer = min(uio->uio_resid, sc->mode.packetsize - sc->sc_bytesread);
if (error = uiomove(&sc->sc_bytes[sc->sc_bytesread], xfer, uio))
error = uiomove(&sc->sc_bytes[sc->sc_bytesread], xfer, uio);
if (error)
return (error);
sc->sc_bytesread += xfer;
return(0);

View File

@ -760,8 +760,9 @@ rcopen(dev, flag, mode, p)
error = EBUSY;
goto out;
}
if (error = tsleep(&rc->rc_rcb,
TTIPRI|PCATCH, "rcbi", 0))
error = tsleep(&rc->rc_rcb,
TTIPRI|PCATCH, "rcbi", 0);
if (error)
goto out;
goto again;
}

View File

@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: rp.c,v 1.23 1999/04/24 20:26:12 billf Exp $
* $Id: rp.c,v 1.24 1999/04/27 11:15:12 phk Exp $
*/
/*
@ -1555,10 +1555,9 @@ rpwrite(dev, uio, flag)
tp = rp->rp_tty;
while(rp->rp_disable_writes) {
rp->rp_waiting = 1;
if(error = ttysleep(tp, (caddr_t)rp, TTOPRI|PCATCH,
"rp_write", 0)) {
error = ttysleep(tp, (caddr_t)rp, TTOPRI|PCATCH, "rp_write", 0);
if (error)
return(error);
}
}
error = (*linesw[tp->t_line].l_write)(tp, uio, flag);
@ -1661,7 +1660,7 @@ rpioctl(dev, cmd, data, flag, p)
dt->c_lflag = (tp->t_lflag & lt->c_lflag)
| (dt->c_lflag & ~lt->c_lflag);
for(cc = 0; cc < NCCS; ++cc)
if(lt->c_cc[cc] = tp->t_cc[cc])
if((lt->c_cc[cc] = tp->t_cc[cc]) != 0)
dt->c_cc[cc] = tp->t_cc[cc];
if(lt->c_ispeed != 0)
dt->c_ispeed = tp->t_ispeed;

View File

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: stallion.c,v 1.27 1999/04/27 11:15:19 phk Exp $
* $Id: stallion.c,v 1.28 1999/04/28 10:52:57 dt Exp $
*/
/*****************************************************************************/
@ -2053,7 +2053,8 @@ static void stl_rxprocess(stlport_t *portp)
} else {
while (portp->rx.tail != head) {
ch = (unsigned char) *(portp->rx.tail);
if (status = *(portp->rx.tail + STL_RXBUFSIZE)) {
status = *(portp->rx.tail + STL_RXBUFSIZE);
if (status) {
*(portp->rx.tail + STL_RXBUFSIZE) = 0;
if (status & ST_BREAK)
ch |= TTY_BI;

View File

@ -481,7 +481,8 @@ int twwrite(dev, uio, ioflag)
*/
s = spltty();
cnt = MIN(3 - sc->sc_pktsize, uio->uio_resid);
if(error = uiomove(&(sc->sc_pkt[sc->sc_pktsize]), cnt, uio)) {
error = uiomove(&(sc->sc_pkt[sc->sc_pktsize]), cnt, uio);
if(error) {
splx(s);
return(error);
}
@ -509,7 +510,8 @@ int twwrite(dev, uio, ioflag)
* originated locally.
*/
while(sc->sc_state & (TWS_RCVING | TWS_XMITTING)) {
if(error = tsleep((caddr_t)sc, TWPRI|PCATCH, "twwrite", 0)) {
error = tsleep((caddr_t)sc, TWPRI|PCATCH, "twwrite", 0);
if(error) {
splx(s);
return(error);
}
@ -860,7 +862,8 @@ int cnt;
while(cnt--) {
while(sc->sc_nextin == sc->sc_nextout) { /* Buffer empty */
sc->sc_state |= TWS_WANT;
if(error = tsleep((caddr_t)(&sc->sc_buf), TWPRI|PCATCH, "twread", 0)) {
error = tsleep((caddr_t)(&sc->sc_buf), TWPRI|PCATCH, "twread", 0);
if(error) {
return(error);
}
}

View File

@ -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: wst.c,v 1.17 1999/04/28 10:53:06 dt Exp $
* $Id: wst.c,v 1.18 1999/05/02 21:46:31 peter Exp $
*/
#include "wdc.h"
@ -744,7 +744,8 @@ wst_erase(struct wst *t)
int error;
struct atapires result;
if (error = wst_rewind(t))
error = wst_rewind(t);
if (error)
return error;
result = atapi_request_wait(t->ata, t->unit,
ATAPI_TAPE_ERASE, 3, 0, 0, 0,

View File

@ -20,7 +20,7 @@
* the original CMU copyright notice.
*
* Version 1.3, Thu Nov 11 12:09:13 MSK 1993
* $Id: wt.c,v 1.47 1998/12/18 18:07:10 bde Exp $
* $Id: wt.c,v 1.48 1999/04/28 10:53:07 dt Exp $
*
*/
@ -295,7 +295,8 @@ wtopen (dev_t dev, int flag, int fmt, struct proc *p)
/* If the tape is in rewound state, check the status and set density. */
if (t->flags & TPSTART) {
/* If rewind is going on, wait */
if (error = wtwait (t, PCATCH, "wtrew"))
error = wtwait (t, PCATCH, "wtrew");
if (error)
return (error);
/* Check the controller status */
@ -450,28 +451,34 @@ wtioctl (dev_t dev, u_long cmd, caddr_t arg, int flags, struct proc *p)
case MTOFFL: /* rewind and put the drive offline */
if (t->flags & TPREW) /* rewind is running */
return (0);
if (error = wtwait (t, PCATCH, "wtorew"))
error = wtwait (t, PCATCH, "wtorew");
if (error)
return (error);
wtrewind (t);
return (0);
case MTFSF: /* forward space file */
for (count=((struct mtop*)arg)->mt_count; count>0; --count) {
if (error = wtwait (t, PCATCH, "wtorfm"))
error = wtwait (t, PCATCH, "wtorfm");
if (error)
return (error);
if (error = wtreadfm (t))
error = wtreadfm (t);
if (error)
return (error);
}
return (0);
case MTWEOF: /* write an end-of-file record */
if (! (t->flags & TPWRITE) || (t->flags & TPWP))
return (EACCES);
if (error = wtwait (t, PCATCH, "wtowfm"))
error = wtwait (t, PCATCH, "wtowfm");
if (error)
return (error);
if (error = wtwritefm (t))
error = wtwritefm (t);
if (error)
return (error);
return (0);
case MTRETENS: /* re-tension tape */
if (error = wtwait (t, PCATCH, "wtretens"))
error = wtwait (t, PCATCH, "wtretens");
if (error)
return (error);
op = QIC_RETENS;
goto erase_retens;
@ -479,7 +486,8 @@ wtioctl (dev_t dev, u_long cmd, caddr_t arg, int flags, struct proc *p)
case MTERASE: /* erase to EOM */
if (! (t->flags & TPWRITE) || (t->flags & TPWP))
return (EACCES);
if (error = wtwait (t, PCATCH, "wterase"))
error = wtwait (t, PCATCH, "wterase");
if (error)
return (error);
op = QIC_ERASE;
erase_retens:
@ -789,9 +797,11 @@ wtwait (wtinfo_t *t, int catch, char *msg)
int error;
TRACE (("wtwait() `%s'\n", msg));
while (t->flags & (TPACTIVE | TPREW | TPRMARK | TPWMARK))
if (error = tsleep ((caddr_t)t, WTPRI | catch, msg, 0))
while (t->flags & (TPACTIVE | TPREW | TPRMARK | TPWMARK)) {
error = tsleep ((caddr_t)t, WTPRI | catch, msg, 0);
if (error)
return (error);
}
return (0);
}

View File

@ -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,

View File

@ -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 <sys/param.h>
@ -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:

View File

@ -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 <sys/param.h>
@ -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;
}

View File

@ -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 <sys/param.h>
@ -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);

View File

@ -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 <sys/param.h>
@ -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;

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: sio.c,v 1.227 1999/04/24 10:41:21 dt Exp $
* $Id: sio.c,v 1.228 1999/04/27 11:15:42 phk Exp $
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
* from: i386/isa sio.c,v 1.234
*/
@ -1395,9 +1395,9 @@ comhardclose(com)
* the next open because it might go up and down while
* we're not watching.
*/
|| !com->active_out
&& !(com->prev_modem_status & MSR_DCD)
&& !(com->it_in.c_cflag & CLOCAL)
|| (!com->active_out
&& !(com->prev_modem_status & MSR_DCD)
&& !(com->it_in.c_cflag & CLOCAL))
|| !(tp->t_state & TS_ISOPEN)) {
(void)commctl(com, TIOCM_DTR, DMBIC);
if (com->dtr_wait != 0 && !(com->state & CS_DTR_OFF)) {
@ -2074,7 +2074,7 @@ comparam(tp, t)
/* check requested parameters */
divisor = ttspeedtab(t->c_ospeed, comspeedtab);
if (divisor < 0 || divisor > 0 && t->c_ispeed != t->c_ospeed)
if (divisor < 0 || (divisor > 0 && t->c_ispeed != t->c_ospeed))
return (EINVAL);
/* parameters are OK, convert them to the com struct and the device */

View File

@ -13,7 +13,7 @@
* bad that happens because of using this software isn't the responsibility
* of the author. This software is distributed AS-IS.
*
* $Id: vfs_aio.c,v 1.45 1999/04/04 21:41:16 dt Exp $
* $Id: vfs_aio.c,v 1.46 1999/04/28 01:04:28 luoqi Exp $
*/
/*
@ -890,7 +890,8 @@ aio_newproc()
struct proc *p, *np;
p = &proc0;
if (error = fork1(p, RFPROC|RFMEM|RFNOWAIT))
error = fork1(p, RFPROC|RFMEM|RFNOWAIT);
if (error)
return error;
np = pfind(p->p_retval[0]);
cpu_set_fork_handler(np, aio_daemon, curproc);

View File

@ -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: wst.c,v 1.17 1999/04/28 10:53:06 dt Exp $
* $Id: wst.c,v 1.18 1999/05/02 21:46:31 peter Exp $
*/
#include "wdc.h"
@ -744,7 +744,8 @@ wst_erase(struct wst *t)
int error;
struct atapires result;
if (error = wst_rewind(t))
error = wst_rewind(t);
if (error)
return error;
result = atapi_request_wait(t->ata, t->unit,
ATAPI_TAPE_ERASE, 3, 0, 0, 0,