From d9ea1be3e2886810aaa5c005106dfc90c64882e7 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sun, 19 Sep 2010 02:28:42 +0200 Subject: [PATCH] Fix various bugs due to the mis-usage of && and ||. --- contrib/tcpdump/print-icmp6.c | 15 +++++++-------- libexec/getty/chat.c | 2 +- sbin/routed/parms.c | 4 ++-- usr.bin/doscmd/trap.c | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/contrib/tcpdump/print-icmp6.c b/contrib/tcpdump/print-icmp6.c index 41d56b68da..75ff1ad6a0 100644 --- a/contrib/tcpdump/print-icmp6.c +++ b/contrib/tcpdump/print-icmp6.c @@ -266,14 +266,13 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented) printf("ICMP6, %s", tok2str(icmp6_type_values,"unknown icmp6 type (%u)",dp->icmp6_type)); /* display cosmetics: print the packet length for printer that use the vflag now */ - if (vflag && (dp->icmp6_type == - ND_ROUTER_SOLICIT || - ND_ROUTER_ADVERT || - ND_NEIGHBOR_ADVERT || - ND_NEIGHBOR_SOLICIT || - ND_REDIRECT || - ICMP6_HADISCOV_REPLY || - ICMP6_MOBILEPREFIX_ADVERT )) + if (vflag && (dp->icmp6_type == ND_ROUTER_SOLICIT || + dp->icmp6_type == ND_ROUTER_ADVERT || + dp->icmp6_type == ND_NEIGHBOR_ADVERT || + dp->icmp6_type == ND_NEIGHBOR_SOLICIT || + dp->icmp6_type == ND_REDIRECT || + dp->icmp6_type == ICMP6_HADISCOV_REPLY || + dp->icmp6_type == ICMP6_MOBILEPREFIX_ADVERT )) printf(", length %u", length); switch (dp->icmp6_type) { diff --git a/libexec/getty/chat.c b/libexec/getty/chat.c index 75bc014ab9..f16f1c0f13 100644 --- a/libexec/getty/chat.c +++ b/libexec/getty/chat.c @@ -399,7 +399,7 @@ chat_send(char const *str) { int r = 0; - if (chat_debug && CHATDEBUG_SEND) + if (chat_debug & CHATDEBUG_SEND) syslog(LOG_DEBUG, "chat_send '%s'", cleanstr(str, strlen(str))); if (*str) { diff --git a/sbin/routed/parms.c b/sbin/routed/parms.c index 054bb5c949..dda7ee0931 100644 --- a/sbin/routed/parms.c +++ b/sbin/routed/parms.c @@ -872,11 +872,11 @@ check_parms(struct parm *new) if ((0 != (new->parm_int_state & GROUP_IS_SOL_OUT) && 0 != (parmp->parm_int_state & GROUP_IS_SOL_OUT) && 0 != ((new->parm_int_state ^ parmp->parm_int_state) - && GROUP_IS_SOL_OUT)) + & GROUP_IS_SOL_OUT)) || (0 != (new->parm_int_state & GROUP_IS_ADV_OUT) && 0 != (parmp->parm_int_state & GROUP_IS_ADV_OUT) && 0 != ((new->parm_int_state ^ parmp->parm_int_state) - && GROUP_IS_ADV_OUT)) + & GROUP_IS_ADV_OUT)) || (new->parm_rdisc_pref != 0 && parmp->parm_rdisc_pref != 0 && new->parm_rdisc_pref != parmp->parm_rdisc_pref) diff --git a/usr.bin/doscmd/trap.c b/usr.bin/doscmd/trap.c index e7e3ba8883..126e983b19 100644 --- a/usr.bin/doscmd/trap.c +++ b/usr.bin/doscmd/trap.c @@ -295,7 +295,7 @@ sigbus(struct sigframe *sf) callback_t func; regcontext_t *REGS = (regcontext_t *)(&sf->sf_uc.uc_mcontext); - if (!(R_EFLAGS && PSL_VM)) + if (!(R_EFLAGS & PSL_VM)) fatal("SIGBUS in the emulator\n"); if ((int)sf->sf_siginfo != 0) { -- 2.41.0