From e8302a72f33aeeb1420b91c6ecfe4a81a63024ea Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sun, 5 Nov 2006 03:17:58 +0000 Subject: [PATCH] net_interface_config does not have to bail w/o ip address --- src/os/win32/win32_sigar.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/os/win32/win32_sigar.c b/src/os/win32/win32_sigar.c index bd329260..4e3b23e5 100644 --- a/src/os/win32/win32_sigar.c +++ b/src/os/win32/win32_sigar.c @@ -2352,19 +2352,17 @@ sigar_net_interface_config_get(sigar_t *sigar, ifr->dwIndex, &ipaddr); - if (status != SIGAR_OK) { - return status; + if (status == SIGAR_OK) { + sigar_net_address_set(ifconfig->address, + ipaddr->dwAddr); + + sigar_net_address_set(ifconfig->netmask, + ipaddr->dwMask); + + sigar_net_address_set(ifconfig->broadcast, + ipaddr->dwBCastAddr); } - sigar_net_address_set(ifconfig->address, - ipaddr->dwAddr); - - sigar_net_address_set(ifconfig->netmask, - ipaddr->dwMask); - - sigar_net_address_set(ifconfig->broadcast, - ipaddr->dwBCastAddr); - /* hack for MS_LOOPBACK_ADAPTER */ if (strnEQ(name, NETIF_LA, sizeof(NETIF_LA)-1)) { ifr->dwType = MIB_IF_TYPE_LOOPBACK; @@ -2377,8 +2375,10 @@ sigar_net_interface_config_get(sigar_t *sigar, SIGAR_NIC_LOOPBACK); } else { - ifconfig->flags |= - SIGAR_IFF_BROADCAST|SIGAR_IFF_MULTICAST; + if (ipaddr) { + ifconfig->flags |= + SIGAR_IFF_BROADCAST|SIGAR_IFF_MULTICAST; + } SIGAR_SSTRCPY(ifconfig->type, SIGAR_NIC_ETHERNET);