changeset 20267:456c3b98d4c8 v8.2.0689

patch 8.2.0689: when using getaddrinfo() the error message is unclear Commit: https://github.com/vim/vim/commit/a38b2b737e244eb2e4f199e070b05f86f4d433d4 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 3 17:03:29 2020 +0200 patch 8.2.0689: when using getaddrinfo() the error message is unclear Problem: When using getaddrinfo() the error message is unclear. Solution: Use gai_strerror() to get the message. (Ozaki Kiichi, closes #6034)
author Bram Moolenaar <Bram@vim.org>
date Sun, 03 May 2020 17:15:04 +0200
parents cb107e572f1c
children 1a61225dc1d8
files src/channel.c src/version.c
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -955,6 +955,7 @@ channel_open(
     int			sd = -1;
     channel_T		*channel = NULL;
 #ifdef FEAT_IPV6
+    int			err;
     struct addrinfo	hints;
     struct addrinfo	*res = NULL;
     struct addrinfo	*addr = NULL;
@@ -986,10 +987,11 @@ channel_open(
     // Set port number manually in order to prevent name resolution services
     // from being invoked in the environment where AI_NUMERICSERV is not
     // defined.
-    if (getaddrinfo(hostname, NULL, &hints, &res) != 0)
+    if ((err = getaddrinfo(hostname, NULL, &hints, &res)) != 0)
     {
 	ch_error(channel, "in getaddrinfo() in channel_open()");
-	PERROR(_("E901: getaddrinfo() in channel_open()"));
+	semsg(_("E901: getaddrinfo() in channel_open(): %s"),
+							   gai_strerror(err));
 	channel_free(channel);
 	return NULL;
     }
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    689,
+/**/
     688,
 /**/
     687,