Logical vs. bitwise AND in sbin/routed/parms.c

Bruce Cran bruce at cran.org.uk
Mon Nov 22 16:27:29 UTC 2010


I've been going through src/bin and src/sbin seeing how easy it would
be to remove warnings clang generates. During the work I came
across routed/parms.c which appears to be doing a logical instead of
bitwise AND. Would the following change be correct?

Index: /usr/src/head/sbin/routed/parms.c
===================================================================
--- /usr/src/head/sbin/routed/parms.c   (revision 215671)
+++ /usr/src/head/sbin/routed/parms.c   (working copy)
@@ -876,11 +876,11 @@
                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)

-- 
Bruce Cran


More information about the freebsd-hackers mailing list