From 1f8a8a66e45285a62691983936d453c541fbb15b Mon Sep 17 00:00:00 2001 From: John Marino Date: Tue, 10 Feb 2015 22:15:00 +0100 Subject: [PATCH] rtsol(8): Fix loop bug (aggressive-loop-optimizations) The index was being checked for validity after the array was accessed, putting the check first makes gcc 5.0 happy. --- usr.sbin/rtsold/probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/rtsold/probe.c b/usr.sbin/rtsold/probe.c index daf5f51ff2..dce8d9f631 100644 --- a/usr.sbin/rtsold/probe.c +++ b/usr.sbin/rtsold/probe.c @@ -121,7 +121,7 @@ defrouter_probe(int ifindex) goto closeandend; } - for(i = 0; dr.defrouter[i].if_index && i < PRLSTSIZ; i++) { + for(i = 0; i < PRLSTSIZ && dr.defrouter[i].if_index; i++) { if (ifindex && dr.defrouter[i].if_index == ifindex) { /* sanity check */ if (!IN6_IS_ADDR_LINKLOCAL(&dr.defrouter[i].rtaddr)) { -- 2.41.0