From 266ee6424f146b238c69ae26af95173582b4bc8a Mon Sep 17 00:00:00 2001 From: Andrew Paprocki Date: Wed, 27 May 2015 16:49:58 -0400 Subject: [PATCH] test: fix `platform_output` netmask printing. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Saúl Ibarra Corretgé --- test/test-platform-output.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test-platform-output.c b/test/test-platform-output.c index dc6fa32b0..76495e14f 100644 --- a/test/test-platform-output.c +++ b/test/test-platform-output.c @@ -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);