[Dnsmasq-discuss] [PATCH 2/2] rfc3315: fix incorrect logical '&&' warning

Kevin Darbyshire-Bryant ldir at darbyshire-bryant.me.uk
Fri Mar 6 10:31:17 GMT 2020


rfc3315.c:1711:28: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
    if (!(addr_list->flags && ADDRLIST_DECLINED) ||
                           ^  ~~~~~~~~~~~~~~~~~

It's a flag bit so should be bitwise '&' operator

Signed-off-by: Kevin Darbyshire-Bryant <ldir at darbyshire-bryant.me.uk>
---
 src/rfc3315.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rfc3315.c b/src/rfc3315.c
index eec8776..43ed4f8 100644
--- a/src/rfc3315.c
+++ b/src/rfc3315.c
@@ -1708,7 +1708,7 @@ static int config_valid(struct dhcp_config *config, struct dhcp_context *context
     return 0;
 
   for (addr_list = config->addr6; addr_list; addr_list = addr_list->next)
-    if (!(addr_list->flags && ADDRLIST_DECLINED) ||
+    if (!(addr_list->flags & ADDRLIST_DECLINED) ||
 	difftime(now, addr_list->decline_time) >= (float)DECLINE_BACKOFF)
       {
 	addrpart = addr6part(&addr_list->addr.addr6);
-- 
2.21.1 (Apple Git-122.3)




More information about the Dnsmasq-discuss mailing list