diff options
author | Steve Holme <steve_holme@hotmail.com> | 2014-12-26 13:28:29 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2014-12-26 13:28:29 +0000 |
commit | b7f740f2fc6c9b5e96ccbc013aeaae4093a9f1ed (patch) | |
tree | 46f93ade468db82b9c37a56618539ef4d9d14291 | |
parent | cdc1cc22e75bbe6434e9603c91e933171ac9edf2 (diff) |
ip2ip.c: Fixed compilation warning when IPv6 Scope ID not supported
if2ip.c:119: warning: unused parameter 'remote_scope_id'
...and some minor code style policing in the same function.
-rw-r--r-- | lib/if2ip.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/if2ip.c b/lib/if2ip.c index 15ea9521e..389feed1c 100644 --- a/lib/if2ip.c +++ b/lib/if2ip.c @@ -124,16 +124,21 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope, #ifndef ENABLE_IPV6 (void) remote_scope; + +#ifndef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID + (void) remote_scope_id; +#endif + #endif if(getifaddrs(&head) >= 0) { - for(iface=head; iface != NULL; iface=iface->ifa_next) { + for(iface = head; iface != NULL; iface=iface->ifa_next) { if(iface->ifa_addr != NULL) { if(iface->ifa_addr->sa_family == af) { if(curl_strequal(iface->ifa_name, interf)) { void *addr; char *ip; - char scope[12]=""; + char scope[12] = ""; char ipstr[64]; #ifdef ENABLE_IPV6 if(af == AF_INET6) { @@ -157,7 +162,9 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope, /* If given, scope id should match. */ if(remote_scope_id && scopeid != remote_scope_id) { - if(res == IF2IP_NOT_FOUND) res = IF2IP_AF_NOT_SUPPORTED; + if(res == IF2IP_NOT_FOUND) + res = IF2IP_AF_NOT_SUPPORTED; + continue; } #endif @@ -179,8 +186,10 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope, } } } + freeifaddrs(head); } + return res; } |