From 39b3bc0082050af08e19d80059ddca66355559ce Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 27 Nov 2019 18:16:37 +0200 Subject: [PATCH] ; Fix recent change in w32.c * src/w32.c (network_interface_list): Correct an embarrassing typo and cleanup the code. --- src/w32.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/w32.c b/src/w32.c index cb82d51fb92..a6ebe55ee4d 100644 --- a/src/w32.c +++ b/src/w32.c @@ -9642,8 +9642,7 @@ network_interface_list (bool full, unsigned short match) #else /* Kludge alert! OnLinkPrefixLength is only defined when compiling for Vista and later. */ - numbits = *(UINT8 *) (address->LeaseLifetime - + sizeof (address->LeaseLifetime)); + numbits = *(UINT8 *) (&address->LeaseLifetime + 1); #endif } else /* Windows XP */ @@ -9652,14 +9651,14 @@ network_interface_list (bool full, unsigned short match) numbits = 0; for ( ; prefix; prefix = prefix->Next) { - /* We want the longest matching prefix. */ - if (prefix->Address.lpSockaddr->sa_family - != ifa_addr->sa_family - || prefix->PrefixLength <= numbits) - continue; - if (address_prefix_match (ifa_addr->sa_family, ifa_addr, - prefix->Address.lpSockaddr, - prefix->PrefixLength)) + /* We want the longest matching prefix. */ + if ((prefix->Address.lpSockaddr->sa_family + == ifa_addr->sa_family) + && (prefix->PrefixLength > numbits) + && address_prefix_match (ifa_addr->sa_family, + ifa_addr, + prefix->Address.lpSockaddr, + prefix->PrefixLength)) numbits = prefix->PrefixLength; } if (!numbits) -- 2.39.5