network-info 0.2 → 0.2.0.1
raw patch · 2 files changed
+13/−6 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- cbits/network-unix.c +10/−3
- network-info.cabal +3/−3
cbits/network-unix.c view
@@ -61,7 +61,7 @@ struct sockaddr *addr; wchar_t name[NAME_SIZE]; int family, error;- + error = getifaddrs(&ifaddr); if (error != 0) { perror("getifaddrs");@@ -71,12 +71,19 @@ memset(ns, 0, sizeof(struct network_interface) * max_ns); for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {- mbswszcopy(name, ifa->ifa_name, NAME_SIZE);+ /* check we actually have an address in this item */ addr = ifa->ifa_addr;- family = addr->sa_family;+ if (addr == NULL)+ continue; + /* convert the interface name to wide characters */+ mbswszcopy(name, ifa->ifa_name, NAME_SIZE);++ /* lookup or add a new interface with the given name */ n = add_interface(ns, name, max_ns); + /* extract the address from this item */+ family = addr->sa_family; if (family == AF_INET) { ipv4copy(&n->ip_address, addr); } else if (family == AF_INET6) {
network-info.cabal view
@@ -1,5 +1,5 @@ name: network-info-version: 0.2+version: 0.2.0.1 synopsis: Access the local computer's basic network configuration description: This library provides simple read-only access to the local computer's networking configuration. It is currently capable of getting a list of@@ -12,7 +12,7 @@ license: BSD3 license-file: LICENSE author: Jacob Stanley-maintainer: jacob@stanley.io+maintainer: Jacob Stanley <jacob@stanley.io> category: Network build-type: Simple cabal-version: >= 1.6@@ -36,7 +36,7 @@ cc-options: -Wall -Werror exposed-modules: Network.Info- + build-depends: base == 4.*