From b6fb0516ec862a18fdffe06c9400d507a7193835 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 18 Apr 2020 18:24:18 +0200 Subject: patch 8.2.0594: MS-Windows: cannot build with WINVER set to 0x0501 Problem: MS-Windows: cannot build with WINVER set to 0x0501. Solution: Only use inet_ntop() when available. (Ozaki Kiichi, closes #5946) --- src/channel.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/channel.c') diff --git a/src/channel.c b/src/channel.c index 0d86423b69..9577f3dc46 100644 --- a/src/channel.c +++ b/src/channel.c @@ -996,9 +996,11 @@ channel_open( for (addr = res; addr != NULL; addr = addr->ai_next) { - const char *dst = hostname; - const void *src = NULL; - char buf[NUMBUFLEN]; + const char *dst = hostname; + const void *src = NULL; +# ifdef HAVE_INET_NTOP + char buf[NUMBUFLEN]; +# endif if (addr->ai_family == AF_INET6) { @@ -1014,12 +1016,16 @@ channel_open( sai->sin_port = htons(port); src = &sai->sin_addr; } +# ifdef HAVE_INET_NTOP if (src != NULL) { dst = inet_ntop(addr->ai_family, src, buf, sizeof(buf)); - if (dst != NULL && STRCMP(hostname, dst) != 0) + if (dst == NULL) + dst = hostname; + else if (STRCMP(hostname, dst) != 0) ch_log(channel, "Resolved %s to %s", hostname, dst); } +# endif ch_log(channel, "Trying to connect to %s port %d", dst, port); -- cgit v1.2.3