summaryrefslogtreecommitdiffstats
path: root/src/channel.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-18 18:24:18 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-18 18:24:18 +0200
commitb6fb0516ec862a18fdffe06c9400d507a7193835 (patch)
tree4ff904f75596cb65758ee6a39dba61da97abea58 /src/channel.c
parenta494f56f885876c98a276f7acfa386bfbb344680 (diff)
patch 8.2.0594: MS-Windows: cannot build with WINVER set to 0x0501v8.2.0594
Problem: MS-Windows: cannot build with WINVER set to 0x0501. Solution: Only use inet_ntop() when available. (Ozaki Kiichi, closes #5946)
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c14
1 files changed, 10 insertions, 4 deletions
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);