1
0
mirror of https://github.com/libuv/libuv synced 2025-03-28 21:13:16 +00:00

test: fix platform_output netmask printing.

The implementation will leave the family set to `AF_UNSPEC` if a
netmask is not present, but the test driver would always print the
uninitialized buffer as an `AF_INET4` address.  It will now print
"none" if there is no netmask (e.g., for loopback interfaces).

PR-URL: https://github.com/libuv/libuv/pull/373
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
Andrew Paprocki 2015-05-27 16:49:58 -04:00 committed by Saúl Ibarra Corretgé
parent 1816dbc85f
commit 266ee6424f

View File

@ -112,11 +112,13 @@ TEST_IMPL(platform_output) {
if (interfaces[i].netmask.netmask4.sin_family == AF_INET) {
uv_ip4_name(&interfaces[i].netmask.netmask4, buffer, sizeof(buffer));
printf(" netmask: %s\n", buffer);
} else if (interfaces[i].netmask.netmask4.sin_family == AF_INET6) {
uv_ip6_name(&interfaces[i].netmask.netmask6, buffer, sizeof(buffer));
printf(" netmask: %s\n", buffer);
} else {
printf(" netmask: none\n");
}
printf(" netmask: %s\n", buffer);
}
uv_free_interface_addresses(interfaces, count);