Mercurial > vim
diff src/channel.c @ 20077:128963cd954f v8.2.0594
patch 8.2.0594: MS-Windows: cannot build with WINVER set to 0x0501
Commit: https://github.com/vim/vim/commit/b6fb0516ec862a18fdffe06c9400d507a7193835
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 18 18:24:18 2020 +0200
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 https://github.com/vim/vim/issues/5946)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 18 Apr 2020 18:30:03 +0200 |
parents | aadd1cae2ff5 |
children | 456c3b98d4c8 |
line wrap: on
line diff
--- 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);