[PATCH v3] route: Clarify operator precedence in a & b ? c : d

Gert Doering <[email protected]>
Newsgroups gmane.network.openvpn.devel
Message-ID <[email protected]>
From: Frank Lichtenheld <[email protected]>

As suggested by cppcheck.

Change-Id: I5c9b54dca0a14688a3bb7798cb086f5bde7311b8
Signed-off-by: Frank Lichtenheld <[email protected]>
Acked-by: Gert Doering <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1668
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1668
This mail reflects revision 3 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]>

        
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index 3b18f74..81ce867 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -2884,7 +2884,7 @@
                             .prefix.ipv4.s_addr = htonl(r->network),
                             .gateway.ipv4.s_addr = htonl(r->gateway),
                             .iface = { .index = if_index, .name = "" },
-                            .metric = (r->flags & RT_METRIC_DEFINED ? r->metric : -1) };
+                            .metric = (r->flags & RT_METRIC_DEFINED) ? r->metric : -1 };
 
     netmask_to_netbits(r->network, r->netmask, &msg.prefix_len);
     if (msg.prefix_len == -1)
@@ -2986,7 +2986,7 @@
                             .prefix_len = r->netbits,
                             .gateway.ipv6 = r->gateway,
                             .iface = { .index = tt->adapter_index, .name = "" },
-                            .metric = ((r->flags & RT_METRIC_DEFINED) ? r->metric : -1) };
+                            .metric = (r->flags & RT_METRIC_DEFINED) ? r->metric : -1 };
 
     if (r->adapter_index) /* vpn server special route */
     {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.