Fix various bugs due to the mis-usage of && and ||.
authorSascha Wildner <saw@online.de>
Sun, 19 Sep 2010 00:28:42 +0000 (02:28 +0200)
committerSascha Wildner <saw@online.de>
Sun, 19 Sep 2010 00:28:42 +0000 (02:28 +0200)
contrib/tcpdump/print-icmp6.c
libexec/getty/chat.c
sbin/routed/parms.c
usr.bin/doscmd/trap.c

index 41d56b6..75ff1ad 100644 (file)
@@ -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) {
index 75bc014..f16f1c0 100644 (file)
@@ -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) {
index 054bb5c..dda7ee0 100644 (file)
@@ -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)
index e7e3ba8..126e983 100644 (file)
@@ -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) {