Subject: kern/5333: GCC 2.8.1 complains about missing parenteses in if-else
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ivanenko@ctpa03.mit.edu>
List: netbsd-bugs
Date: 04/21/1998 10:57:46
>Number: 5333
>Category: kern
>Synopsis: GCC 2.8.1 complains about missing parenteses in if-else
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Apr 21 08:05:01 1998
>Last-Modified:
>Originator:
>Organization:
working for myself
>Release: <NetBSD-current source date> current as ofTue Apr 21 10:46:55 EDT 1998
>Environment:
Cross-compiling with standard gcc 2.8.1 distribution from SunOS 4.1.3 to
NetBSD/mac68k, gcc configured with
./configure --target=m68k-apple-netbsd --with-gnu-as
System: SunOS 4.1.3 2 sun4c
Architecture: sun4
>Description:
The statements in questions look like
if(condition)
if(condition)
statement;
else
statement;
"else" part is ambiguos and GCC suggests putting explicit parenteses.
Since kernel is compiled with -Werror, compilation stops. One solution is
to put -Wno-parenteses in compiler switches or (I think better) apply the
patch below. The following files are affected (in MI part)
sys/kern/kern_malloc.c
sys/kern/tty.c
sys/kern/kern_proc.c
sys/kern/kern_time.c
sys/kern/subr_log.c
sys/kern/vfs_cluster.c
sys/ufs/ffs/ffs_alloc.c
sys/ufs/lfs/lfs_balloc.c
sys/ufs/lfs/lfs_subr.c
sys/ufs/ufs/ufs_readwrite.c
sys/ufs/ext2fs/ext2fs_readwrite.c
sys/msdosfs/msdosfs_vfsops.c
sys/msdosfs/msdosfs_vnops.c
sys/net/bpf.c
sys/net/if_tun.c
sys/netccitt/if_x25subr.c
sys/netccitt/llc_subr.c
sys/netccitt/pk_llcsubr.c
sys/netccitt/pk_subr.c
sys/netiso/clnp_er.c
sys/netiso/clnp_raw.c
sys/netiso/if_eon.c
sys/netiso/iso_snpac.c
sys/netiso/tp_driver.c
sys/netiso/tp_iso.c
sys/netns/ns_pcb.c
sys/nfs/nfs_serv.c
sys/miscfs/specfs/spec_vnops.c
The warnings in those files were triggered while compiling mac68k/GENERIC
kernel. There are definitely more of those around the code!
>How-To-Repeat:
See environment above. I have not tried to compile GCC 2.8.1 on NetBSD box,
it would take forenver on my Mac IIcx
>Fix:
Here is the diff -c
*** /syjet/src/sys/kern/kern_malloc.c Sun Mar 1 07:21:12 1998
--- sys/kern/kern_malloc.c Fri Apr 17 22:15:05 1998
***************
*** 505,515 ****
#endif /* DIAGNOSTIC */
#ifdef KMEMSTATS
kup->ku_freecnt++;
! if (kup->ku_freecnt >= kbp->kb_elmpercl)
! if (kup->ku_freecnt > kbp->kb_elmpercl)
panic("free: multiple frees");
! else if (kbp->kb_totalfree > kbp->kb_highwat)
kbp->kb_couldfree++;
kbp->kb_totalfree++;
ksp->ks_memuse -= size;
if (ksp->ks_memuse + size >= ksp->ks_limit &&
--- 505,516 ----
#endif /* DIAGNOSTIC */
#ifdef KMEMSTATS
kup->ku_freecnt++;
! if (kup->ku_freecnt >= kbp->kb_elmpercl) {
! if (kup->ku_freecnt > kbp->kb_elmpercl) {
panic("free: multiple frees");
! } else if (kbp->kb_totalfree > kbp->kb_highwat)
kbp->kb_couldfree++;
+ }
kbp->kb_totalfree++;
ksp->ks_memuse -= size;
if (ksp->ks_memuse + size >= ksp->ks_limit &&
*** /syjet/src/sys/kern/tty.c Sun Mar 22 07:20:50 1998
--- sys/kern/tty.c Sat Apr 18 21:22:43 1998
***************
*** 900,906 ****
}
if (cmd != TIOCSETAF) {
if (ISSET(t->c_lflag, ICANON) !=
! ISSET(tp->t_lflag, ICANON))
if (ISSET(t->c_lflag, ICANON)) {
SET(tp->t_lflag, PENDIN);
ttwakeup(tp);
--- 900,906 ----
}
if (cmd != TIOCSETAF) {
if (ISSET(t->c_lflag, ICANON) !=
! ISSET(tp->t_lflag, ICANON)) {
if (ISSET(t->c_lflag, ICANON)) {
SET(tp->t_lflag, PENDIN);
ttwakeup(tp);
***************
*** 913,918 ****
--- 913,919 ----
tp->t_canq = tq;
CLR(tp->t_lflag, PENDIN);
}
+ }
}
tp->t_iflag = t->c_iflag;
tp->t_oflag = t->c_oflag;
*** /syjet/src/sys/kern/kern_proc.c Sun Mar 1 07:21:12 1998
--- sys/kern/kern_proc.c Fri Apr 17 22:17:33 1998
***************
*** 310,320 ****
* group; if so, adjust count for p's process group.
*/
if ((hispgrp = p->p_pptr->p_pgrp) != pgrp &&
! hispgrp->pg_session == mysession)
if (entering)
pgrp->pg_jobc++;
else if (--pgrp->pg_jobc == 0)
orphanpg(pgrp);
/*
* Check this process' children to see whether they qualify
--- 310,321 ----
* group; if so, adjust count for p's process group.
*/
if ((hispgrp = p->p_pptr->p_pgrp) != pgrp &&
! hispgrp->pg_session == mysession) {
if (entering)
pgrp->pg_jobc++;
else if (--pgrp->pg_jobc == 0)
orphanpg(pgrp);
+ }
/*
* Check this process' children to see whether they qualify
***************
*** 321,334 ****
* their process groups; if so, adjust counts for children's
* process groups.
*/
! for (p = p->p_children.lh_first; p != 0; p = p->p_sibling.le_next)
if ((hispgrp = p->p_pgrp) != pgrp &&
hispgrp->pg_session == mysession &&
! p->p_stat != SZOMB)
if (entering)
hispgrp->pg_jobc++;
else if (--hispgrp->pg_jobc == 0)
orphanpg(hispgrp);
}
/*
--- 322,337 ----
* their process groups; if so, adjust counts for children's
* process groups.
*/
! for (p = p->p_children.lh_first; p != 0; p = p->p_sibling.le_next) {
if ((hispgrp = p->p_pgrp) != pgrp &&
hispgrp->pg_session == mysession &&
! p->p_stat != SZOMB) {
if (entering)
hispgrp->pg_jobc++;
else if (--hispgrp->pg_jobc == 0)
orphanpg(hispgrp);
+ }
+ }
}
/*
*** /syjet/src/sys/kern/kern_time.c Sun Mar 1 07:21:16 1998
--- sys/kern/kern_time.c Fri Apr 17 22:42:06 1998
***************
*** 428,438 ****
* current time and time for the timer to go off.
*/
aitv = p->p_realtimer;
! if (timerisset(&aitv.it_value))
if (timercmp(&aitv.it_value, &time, <))
timerclear(&aitv.it_value);
else
timersub(&aitv.it_value, &time, &aitv.it_value);
} else
aitv = p->p_stats->p_timer[which];
splx(s);
--- 428,439 ----
* current time and time for the timer to go off.
*/
aitv = p->p_realtimer;
! if (timerisset(&aitv.it_value)) {
if (timercmp(&aitv.it_value, &time, <))
timerclear(&aitv.it_value);
else
timersub(&aitv.it_value, &time, &aitv.it_value);
+ }
} else
aitv = p->p_stats->p_timer[which];
splx(s);
***************
*** 480,487 ****
timeout(realitexpire, p, hzto(&aitv.it_value));
}
p->p_realtimer = aitv;
! } else
p->p_stats->p_timer[which] = aitv;
splx(s);
return (0);
}
--- 481,489 ----
timeout(realitexpire, p, hzto(&aitv.it_value));
}
p->p_realtimer = aitv;
! } else {
p->p_stats->p_timer[which] = aitv;
+ }
splx(s);
return (0);
}
*** /syjet/src/sys/kern/subr_log.c Sun Mar 1 07:21:18 1998
--- sys/kern/subr_log.c Sat Apr 18 21:19:44 1998
***************
*** 198,208 ****
int revents = 0;
int s = splhigh();
! if (events & (POLLIN | POLLRDNORM))
if (msgbufp->msg_bufr != msgbufp->msg_bufx)
revents |= events & (POLLIN | POLLRDNORM);
else
selrecord(p, &logsoftc.sc_selp);
splx(s);
return (revents);
--- 198,209 ----
int revents = 0;
int s = splhigh();
! if (events & (POLLIN | POLLRDNORM)) {
if (msgbufp->msg_bufr != msgbufp->msg_bufx)
revents |= events & (POLLIN | POLLRDNORM);
else
selrecord(p, &logsoftc.sc_selp);
+ }
splx(s);
return (revents);
*** /syjet/src/sys/kern/vfs_cluster.c Tue Mar 3 07:25:55 1998
--- sys/kern/vfs_cluster.c Sat Apr 18 21:22:42 1998
***************
*** 251,269 ****
/* XXX Kirk, do we need to make sure the bp has creds? */
skip_readahead:
! if (bp)
if (bp->b_flags & (B_DONE | B_DELWRI))
panic("cluster_read: DONE bp");
else
error = VOP_STRATEGY(bp);
! if (rbp)
if (error || rbp->b_flags & (B_DONE | B_DELWRI)) {
rbp->b_flags &= ~(B_ASYNC | B_READ);
brelse(rbp);
} else
(void) VOP_STRATEGY(rbp);
!
/*
* Recalculate our maximum readahead
*/
--- 251,270 ----
/* XXX Kirk, do we need to make sure the bp has creds? */
skip_readahead:
! if (bp) {
if (bp->b_flags & (B_DONE | B_DELWRI))
panic("cluster_read: DONE bp");
else
error = VOP_STRATEGY(bp);
+ }
! if (rbp) {
if (error || rbp->b_flags & (B_DONE | B_DELWRI)) {
rbp->b_flags &= ~(B_ASYNC | B_READ);
brelse(rbp);
} else
(void) VOP_STRATEGY(rbp);
! }
/*
* Recalculate our maximum readahead
*/
*** /syjet/src/sys/ufs/ffs/ffs_alloc.c Thu Mar 19 07:23:55 1998
--- sys/ufs/ffs/ffs_alloc.c Sat Apr 18 21:41:28 1998
***************
*** 480,490 ****
VOP_UPDATE(vp, &ts, &ts, 1);
}
}
! if (ssize < len)
if (doasyncfree)
bdwrite(ebp);
else
bwrite(ebp);
/*
* Last, free the old blocks and assign the new blocks to the buffers.
*/
--- 480,491 ----
VOP_UPDATE(vp, &ts, &ts, 1);
}
}
! if (ssize < len) {
if (doasyncfree)
bdwrite(ebp);
else
bwrite(ebp);
+ }
/*
* Last, free the old blocks and assign the new blocks to the buffers.
*/
*** /syjet/src/sys/ufs/lfs/lfs_balloc.c Tue Mar 3 07:26:20 1998
--- sys/ufs/lfs/lfs_balloc.c Sat Apr 18 21:43:33 1998
***************
*** 176,182 ****
* for free space and update the inode number of blocks.
*/
if (!(bp->b_flags & (B_CACHE | B_DONE | B_DELWRI))) {
! if (daddr == UNASSIGNED)
if (!ISSPACE(fs, bb, curproc->p_ucred)) {
bp->b_flags |= B_INVAL;
brelse(bp);
--- 176,182 ----
* for free space and update the inode number of blocks.
*/
if (!(bp->b_flags & (B_CACHE | B_DONE | B_DELWRI))) {
! if (daddr == UNASSIGNED) {
if (!ISSPACE(fs, bb, curproc->p_ucred)) {
bp->b_flags |= B_INVAL;
brelse(bp);
***************
*** 187,193 ****
if (iosize != fs->lfs_bsize)
clrbuf(bp);
}
! else if (iosize == fs->lfs_bsize)
/* Optimization: I/O is unnecessary. */
bp->b_blkno = daddr;
else {
--- 187,193 ----
if (iosize != fs->lfs_bsize)
clrbuf(bp);
}
! } else if (iosize == fs->lfs_bsize)
/* Optimization: I/O is unnecessary. */
bp->b_blkno = daddr;
else {
*** /syjet/src/sys/ufs/lfs/lfs_subr.c Sun Mar 1 07:22:53 1998
--- sys/ufs/lfs/lfs_subr.c Sat Apr 18 21:44:14 1998
***************
*** 99,105 ****
struct segment *sp;
int s;
! if (fs->lfs_seglock)
if (fs->lfs_lockpid == curproc->p_pid) {
++fs->lfs_seglock;
fs->lfs_sp->seg_flags |= flags;
--- 99,105 ----
struct segment *sp;
int s;
! if (fs->lfs_seglock) {
if (fs->lfs_lockpid == curproc->p_pid) {
++fs->lfs_seglock;
fs->lfs_sp->seg_flags |= flags;
***************
*** 107,113 ****
} else while (fs->lfs_seglock)
(void)tsleep(&fs->lfs_seglock, PRIBIO + 1,
"lfs seglock", 0);
!
fs->lfs_seglock = 1;
fs->lfs_lockpid = curproc->p_pid;
--- 107,113 ----
} else while (fs->lfs_seglock)
(void)tsleep(&fs->lfs_seglock, PRIBIO + 1,
"lfs seglock", 0);
! }
fs->lfs_seglock = 1;
fs->lfs_lockpid = curproc->p_pid;
*** /syjet/src/sys/ufs/ufs/ufs_readwrite.c Sun Mar 1 07:23:07 1998
--- sys/ufs/ufs/ufs_readwrite.c Sat Apr 18 21:42:42 1998
***************
*** 280,291 ****
#else
if (ioflag & IO_SYNC)
(void)bwrite(bp);
! else if (xfersize + blkoffset == fs->fs_bsize)
if (doclusterwrite)
cluster_write(bp, ip->i_ffs_size);
else
bawrite(bp);
! else
bdwrite(bp);
#endif
if (error || xfersize == 0)
--- 280,291 ----
#else
if (ioflag & IO_SYNC)
(void)bwrite(bp);
! else if (xfersize + blkoffset == fs->fs_bsize) {
if (doclusterwrite)
cluster_write(bp, ip->i_ffs_size);
else
bawrite(bp);
! } else
bdwrite(bp);
#endif
if (error || xfersize == 0)
*** /syjet/src/sys/ufs/ext2fs/ext2fs_readwrite.c Sun Mar 1 07:22:43 1998
--- sys/ufs/ext2fs/ext2fs_readwrite.c Sat Apr 18 21:41:00 1998
***************
*** 278,289 ****
uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio);
if (ioflag & IO_SYNC)
(void)bwrite(bp);
! else if (xfersize + blkoffset == fs->e2fs_bsize)
if (doclusterwrite)
cluster_write(bp, ip->i_e2fs_size);
else
bawrite(bp);
! else
bdwrite(bp);
if (error || xfersize == 0)
break;
--- 278,289 ----
uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio);
if (ioflag & IO_SYNC)
(void)bwrite(bp);
! else if (xfersize + blkoffset == fs->e2fs_bsize) {
if (doclusterwrite)
cluster_write(bp, ip->i_e2fs_size);
else
bawrite(bp);
! } else
bdwrite(bp);
if (error || xfersize == 0)
break;
*** /syjet/src/sys/msdosfs/msdosfs_vfsops.c Sun Mar 1 07:22:02 1998
--- sys/msdosfs/msdosfs_vfsops.c Sat Apr 18 21:24:08 1998
***************
*** 853,864 ****
* If we ever switch to not updating all of the fats all the time,
* this would be the place to update them from the first one.
*/
! if (pmp->pm_fmod != 0)
if (pmp->pm_flags & MSDOSFSMNT_RONLY)
panic("msdosfs_sync: rofs mod");
else {
/* update fats here */
}
/*
* Write back each (modified) denode.
*/
--- 853,865 ----
* If we ever switch to not updating all of the fats all the time,
* this would be the place to update them from the first one.
*/
! if (pmp->pm_fmod != 0) {
if (pmp->pm_flags & MSDOSFSMNT_RONLY)
panic("msdosfs_sync: rofs mod");
else {
/* update fats here */
}
+ }
/*
* Write back each (modified) denode.
*/
*** /syjet/src/sys/msdosfs/msdosfs_vnops.c Tue Apr 21 07:13:28 1998
--- sys/msdosfs/msdosfs_vnops.c Sat Apr 18 21:24:40 1998
***************
*** 1643,1649 ****
if (FAT32(pmp))
fileno |= getushort(dentp->deHighClust) << 16;
/* if this is the root directory */
! if (fileno == MSDOSFSROOT)
if (FAT32(pmp))
fileno = cntobn(pmp,
pmp->pm_rootdirblk)
--- 1641,1647 ----
if (FAT32(pmp))
fileno |= getushort(dentp->deHighClust) << 16;
/* if this is the root directory */
! if (fileno == MSDOSFSROOT) {
if (FAT32(pmp))
fileno = cntobn(pmp,
pmp->pm_rootdirblk)
***************
*** 1650,1656 ****
* dirsperblk;
else
fileno = 1;
! else
fileno = cntobn(pmp, fileno) * dirsperblk;
dirbuf.d_fileno = fileno;
dirbuf.d_type = DT_DIR;
--- 1648,1654 ----
* dirsperblk;
else
fileno = 1;
! } else
fileno = cntobn(pmp, fileno) * dirsperblk;
dirbuf.d_fileno = fileno;
dirbuf.d_type = DT_DIR;
*** /syjet/src/sys/net/bpf.c Sun Mar 1 07:22:05 1998
--- sys/net/bpf.c Sat Apr 18 21:26:06 1998
***************
*** 559,569 ****
struct proc *p;
wakeup((caddr_t)d);
! if (d->bd_async)
if (d->bd_pgid > 0)
gsignal (d->bd_pgid, SIGIO);
else if ((p = pfind (-d->bd_pgid)) != NULL)
psignal (p, SIGIO);
#if BSD >= 199103
selwakeup(&d->bd_sel);
--- 559,570 ----
struct proc *p;
wakeup((caddr_t)d);
! if (d->bd_async) {
if (d->bd_pgid > 0)
gsignal (d->bd_pgid, SIGIO);
else if ((p = pfind (-d->bd_pgid)) != NULL)
psignal (p, SIGIO);
+ }
#if BSD >= 199103
selwakeup(&d->bd_sel);
***************
*** 1059,1069 ****
/*
* An imitation of the FIONREAD ioctl code.
*/
! if (events & (POLLIN | POLLRDNORM))
if (d->bd_hlen != 0 || (d->bd_immediate && d->bd_slen != 0))
revents |= events & (POLLIN | POLLRDNORM);
else
selrecord(p, &d->bd_sel);
splx(s);
return (revents);
--- 1060,1071 ----
/*
* An imitation of the FIONREAD ioctl code.
*/
! if (events & (POLLIN | POLLRDNORM)) {
if (d->bd_hlen != 0 || (d->bd_immediate && d->bd_slen != 0))
revents |= events & (POLLIN | POLLRDNORM);
else
selrecord(p, &d->bd_sel);
+ }
splx(s);
return (revents);
*** /syjet/src/sys/net/if_tun.c Fri Sep 26 07:24:32 1997
--- sys/net/if_tun.c Sat Apr 18 21:26:53 1998
***************
*** 655,661 ****
s = splimp();
TUNDEBUG("%s: tunpoll\n", ifp->if_xname);
! if (events & (POLLIN | POLLRDNORM))
if (ifp->if_snd.ifq_len > 0) {
TUNDEBUG("%s: tunpoll q=%d\n", ifp->if_xname,
ifp->if_snd.ifq_len);
--- 655,661 ----
s = splimp();
TUNDEBUG("%s: tunpoll\n", ifp->if_xname);
! if (events & (POLLIN | POLLRDNORM)) {
if (ifp->if_snd.ifq_len > 0) {
TUNDEBUG("%s: tunpoll q=%d\n", ifp->if_xname,
ifp->if_snd.ifq_len);
***************
*** 664,670 ****
TUNDEBUG("%s: tunpoll waiting\n", ifp->if_xname);
selrecord(p, &tp->tun_rsel);
}
!
if (events & (POLLOUT | POLLWRNORM))
revents |= events & (POLLOUT | POLLWRNORM);
--- 664,670 ----
TUNDEBUG("%s: tunpoll waiting\n", ifp->if_xname);
selrecord(p, &tp->tun_rsel);
}
! }
if (events & (POLLOUT | POLLWRNORM))
revents |= events & (POLLOUT | POLLWRNORM);
*** /syjet/src/sys/netccitt/if_x25subr.c Wed Jan 28 07:24:42 1998
--- sys/netccitt/if_x25subr.c Sat Apr 18 21:30:48 1998
***************
*** 450,457 ****
SA(rn_addmask((caddr_t) & x25_dgmask, 0, 4)->rn_key);
}
if (rt->rt_flags & RTF_GATEWAY) {
! if (rt->rt_llinfo)
RTFREE((struct rtentry *) rt->rt_llinfo);
rt->rt_llinfo = (cmd == RTM_ADD) ?
(caddr_t) rtalloc1(rt->rt_gateway, 1) : 0;
return;
--- 450,458 ----
SA(rn_addmask((caddr_t) & x25_dgmask, 0, 4)->rn_key);
}
if (rt->rt_flags & RTF_GATEWAY) {
! if (rt->rt_llinfo) {
RTFREE((struct rtentry *) rt->rt_llinfo);
+ }
rt->rt_llinfo = (cmd == RTM_ADD) ?
(caddr_t) rtalloc1(rt->rt_gateway, 1) : 0;
return;
*** /syjet/src/sys/netccitt/llc_subr.c Sun Feb 15 08:00:01 1998
--- sys/netccitt/llc_subr.c Sat Apr 18 21:32:13 1998
***************
*** 1154,1160 ****
switch (frame_kind + cmdrsp) {
case NL_DATA_REQUEST:
! if (LLC_GETFLAG(linkp,REMOTE_BUSY) == 0)
if (LLC_GETFLAG(linkp,P) == 0) {
llc_send(linkp, LLCFT_INFO, LLC_CMD, 1);
LLC_START_P_TIMER(linkp);
--- 1154,1160 ----
switch (frame_kind + cmdrsp) {
case NL_DATA_REQUEST:
! if (LLC_GETFLAG(linkp,REMOTE_BUSY) == 0) {
if (LLC_GETFLAG(linkp,P) == 0) {
llc_send(linkp, LLCFT_INFO, LLC_CMD, 1);
LLC_START_P_TIMER(linkp);
***************
*** 1169,1174 ****
--- 1169,1175 ----
LLC_START_ACK_TIMER(linkp);
action = 0;
}
+ }
break;
case LLC_LOCAL_BUSY_CLEARED:{
register int p = LLC_GETFLAG(linkp,P);
***************
*** 1374,1380 ****
}
break;
case LLC_REJ_TIMER_EXPIRED:
! if (linkp->llcl_retry < llc_n2)
if (LLC_GETFLAG(linkp,P) == 0) {
/* multiple possibilities */
llc_send(linkp, LLCFT_RNR, LLC_CMD, 1);
--- 1375,1381 ----
}
break;
case LLC_REJ_TIMER_EXPIRED:
! if (linkp->llcl_retry < llc_n2) {
if (LLC_GETFLAG(linkp,P) == 0) {
/* multiple possibilities */
llc_send(linkp, LLCFT_RNR, LLC_CMD, 1);
***************
*** 1388,1394 ****
LLC_NEWSTATE(linkp,BUSY);
action = 0;
}
!
break;
}
if (action == LLC_PASSITON)
--- 1389,1395 ----
LLC_NEWSTATE(linkp,BUSY);
action = 0;
}
! }
break;
}
if (action == LLC_PASSITON)
*** /syjet/src/sys/netccitt/pk_llcsubr.c Sun Mar 1 07:22:10 1998
--- sys/netccitt/pk_llcsubr.c Sat Apr 18 21:33:05 1998
***************
*** 160,167 ****
return (EEXIST);
if (rt->rt_flags & RTF_GATEWAY) {
! if (rt->rt_llinfo)
RTFREE((struct rtentry *) rt->rt_llinfo);
rt->rt_llinfo = (caddr_t) rtalloc1(rt->rt_gateway, 1);
return (0);
}
--- 160,168 ----
return (EEXIST);
if (rt->rt_flags & RTF_GATEWAY) {
! if (rt->rt_llinfo) {
RTFREE((struct rtentry *) rt->rt_llinfo);
+ }
rt->rt_llinfo = (caddr_t) rtalloc1(rt->rt_gateway, 1);
return (0);
}
***************
*** 230,237 ****
*/
if (pkp) {
if (rt->rt_flags & RTF_GATEWAY) {
! if (rt->rt_llinfo)
RTFREE((struct rtentry *) rt->rt_llinfo);
return (0);
}
if (pkp->pk_llrt)
--- 231,239 ----
*/
if (pkp) {
if (rt->rt_flags & RTF_GATEWAY) {
! if (rt->rt_llinfo) {
RTFREE((struct rtentry *) rt->rt_llinfo);
+ }
return (0);
}
if (pkp->pk_llrt)
*** /syjet/src/sys/netccitt/pk_subr.c Mon Oct 14 12:44:33 1996
--- sys/netccitt/pk_subr.c Sat Apr 18 21:33:59 1998
***************
*** 1142,1153 ****
{
va_list ap;
! if (lcn)
if (!PQEMPTY)
printf("X.25(%s): lcn %d: ", format_ntn(xcp), lcn);
else
printf("X.25: lcn %d: ", lcn);
! else if (!PQEMPTY)
printf("X.25(%s): ", format_ntn(xcp));
else
printf("X.25: ");
--- 1142,1153 ----
{
va_list ap;
! if (lcn) {
if (!PQEMPTY)
printf("X.25(%s): lcn %d: ", format_ntn(xcp), lcn);
else
printf("X.25: lcn %d: ", lcn);
! } else if (!PQEMPTY)
printf("X.25(%s): ", format_ntn(xcp));
else
printf("X.25: ");
*** /syjet/src/sys/netiso/clnp_er.c Mon Oct 14 12:45:48 1996
--- sys/netiso/clnp_er.c Sat Apr 18 21:34:52 1998
***************
*** 373,380 ****
done:
/* free route if it is a temp */
! if (route.ro_rt != NULL)
RTFREE(route.ro_rt);
}
int
--- 373,381 ----
done:
/* free route if it is a temp */
! if (route.ro_rt != NULL) {
RTFREE(route.ro_rt);
+ }
}
int
*** /syjet/src/sys/netiso/clnp_raw.c Mon Oct 14 12:46:07 1996
--- sys/netiso/clnp_raw.c Sat Apr 18 21:35:27 1998
***************
*** 325,332 ****
case PRU_DETACH:
if (rp->risop_isop.isop_options)
m_freem(rp->risop_isop.isop_options);
! if (rp->risop_isop.isop_route.ro_rt)
RTFREE(rp->risop_isop.isop_route.ro_rt);
if (rp->risop_rcb.rcb_laddr)
rp->risop_rcb.rcb_laddr = 0;
/* free clnp cached hdr if necessary */
--- 325,333 ----
case PRU_DETACH:
if (rp->risop_isop.isop_options)
m_freem(rp->risop_isop.isop_options);
! if (rp->risop_isop.isop_route.ro_rt) {
RTFREE(rp->risop_isop.isop_route.ro_rt);
+ }
if (rp->risop_rcb.rcb_laddr)
rp->risop_rcb.rcb_laddr = 0;
/* free clnp cached hdr if necessary */
*** /syjet/src/sys/netiso/if_eon.c Sun Mar 1 07:22:15 1998
--- sys/netiso/if_eon.c Sat Apr 18 21:36:07 1998
***************
*** 289,296 ****
case RTM_DELETE:
if (el) {
remque(&(el->el_qhdr));
! if (el->el_iproute.ro_rt)
RTFREE(el->el_iproute.ro_rt);
Free(el);
rt->rt_llinfo = 0;
}
--- 289,297 ----
case RTM_DELETE:
if (el) {
remque(&(el->el_qhdr));
! if (el->el_iproute.ro_rt) {
RTFREE(el->el_iproute.ro_rt);
+ }
Free(el);
rt->rt_llinfo = 0;
}
*** /syjet/src/sys/netiso/iso_snpac.c Sun Mar 1 07:22:18 1998
--- sys/netiso/iso_snpac.c Sat Apr 18 21:36:36 1998
***************
*** 261,267 ****
bzero((caddr_t) & ifr, sizeof(ifr));
for (cpp = (caddr_t *) addrlist; *cpp; cpp++) {
bcopy(*cpp, (caddr_t) ifr.ifr_addr.sa_data, 6);
! if (req == RTM_ADD)
if (ether_addmulti(&ifr, (struct ethercom *)ifp)
== ENETRESET)
doreset++;
--- 261,267 ----
bzero((caddr_t) & ifr, sizeof(ifr));
for (cpp = (caddr_t *) addrlist; *cpp; cpp++) {
bcopy(*cpp, (caddr_t) ifr.ifr_addr.sa_data, 6);
! if (req == RTM_ADD) {
if (ether_addmulti(&ifr, (struct ethercom *)ifp)
== ENETRESET)
doreset++;
***************
*** 268,273 ****
--- 268,274 ----
else if (ether_delmulti(&ifr, (struct ethercom *)ifp)
== ENETRESET)
doreset++;
+ }
}
if (doreset) {
if (ifp->if_reset)
*** /syjet/src/sys/netiso/tp_iso.c Sun Mar 1 07:22:19 1998
--- sys/netiso/tp_iso.c Sat Apr 18 21:37:46 1998
***************
*** 501,508 ****
/*
* Free route allocated by clnp (if the route was indeed allocated)
*/
! if (tmppcb.isop_route.ro_rt)
RTFREE(tmppcb.isop_route.ro_rt);
return (err);
}
--- 501,509 ----
/*
* Free route allocated by clnp (if the route was indeed allocated)
*/
! if (tmppcb.isop_route.ro_rt) {
RTFREE(tmppcb.isop_route.ro_rt);
+ }
return (err);
}
*** /syjet/src/sys/netns/ns_pcb.c Sat Jul 19 07:21:47 1997
--- sys/netns/ns_pcb.c Sat Apr 18 21:38:33 1998
***************
*** 164,171 ****
*dst = sns->sns_addr;
} else {
flush:
! if (ro->ro_rt)
RTFREE(ro->ro_rt);
ro->ro_rt = (struct rtentry *)0;
nsp->nsp_laddr.x_net = ns_zeronet;
}
--- 164,172 ----
*dst = sns->sns_addr;
} else {
flush:
! if (ro->ro_rt) {
RTFREE(ro->ro_rt);
+ }
ro->ro_rt = (struct rtentry *)0;
nsp->nsp_laddr.x_net = ns_zeronet;
}
*** /syjet/src/sys/nfs/nfs_serv.c Sun Mar 1 07:22:32 1998
--- sys/nfs/nfs_serv.c Sat Apr 18 21:41:02 1998
***************
*** 1888,1898 ****
error = ENOTEMPTY;
goto out;
}
! if (fvp == tdvp)
if (v3)
error = EINVAL;
else
error = ENOTEMPTY;
/*
* If source is the same as the destination (that is the
* same vnode with the same name in the same directory),
--- 1888,1899 ----
error = ENOTEMPTY;
goto out;
}
! if (fvp == tdvp) {
if (v3)
error = EINVAL;
else
error = ENOTEMPTY;
+ }
/*
* If source is the same as the destination (that is the
* same vnode with the same name in the same directory),
*** /syjet/src/sys/miscfs/specfs/spec_vnops.c Sun Mar 1 07:21:54 1998
--- sys/miscfs/specfs/spec_vnops.c Sat Apr 18 21:23:36 1998
***************
*** 418,428 ****
ap->a_fflag, ap->a_p));
case VBLK:
! if (ap->a_command == 0 && (long)ap->a_data == B_TAPE)
if (bdevsw[maj].d_type == D_TAPE)
return (0);
else
return (1);
return ((*bdevsw[maj].d_ioctl)(dev, ap->a_command, ap->a_data,
ap->a_fflag, ap->a_p));
--- 418,429 ----
ap->a_fflag, ap->a_p));
case VBLK:
! if (ap->a_command == 0 && (long)ap->a_data == B_TAPE) {
if (bdevsw[maj].d_type == D_TAPE)
return (0);
else
return (1);
+ }
return ((*bdevsw[maj].d_ioctl)(dev, ap->a_command, ap->a_data,
ap->a_fflag, ap->a_p));
>Audit-Trail:
>Unformatted:
GCC 2.8.1 complains about missing parenteses in if-else
sw-bug