1
0
forked from aniani/vim

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)
This commit is contained in:
Bram Moolenaar
2020-04-18 18:24:18 +02:00
parent a494f56f88
commit b6fb0516ec
7 changed files with 35 additions and 9 deletions

View File

@@ -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);