From 834c4e7da954326f385a2bce21e963e3063e145a Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 28 Aug 2017 22:10:08 +0300 Subject: Use gai_strerror for error messages if getaddrinfo fails. --- io.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'io.c') diff --git a/io.c b/io.c index 02278551..6330fcda 100644 --- a/io.c +++ b/io.c @@ -1586,7 +1586,12 @@ socketopen(int family, int type, const char *localpname, lerror = getaddrinfo(NULL, localpname, & lhints, & lres); if (lerror) { if (strcmp(localpname, "0") != 0) { +#ifdef HAVE_GAI_STRERROR + warning(_("local port %s invalid in `/inet': %s"), localpname, + gai_strerror(lerror)); +#else warning(_("local port %s invalid in `/inet'"), localpname); +#endif *hard_error = true; return INVALID_HANDLE; } @@ -1607,7 +1612,12 @@ socketopen(int family, int type, const char *localpname, if (rerror) { if (lres0 != NULL) freeaddrinfo(lres0); +#ifdef HAVE_GAI_STRERROR + warning(_("remote host and port information (%s, %s) invalid: %s"), remotehostname, remotepname, + gai_strerror(rerror)); +#else warning(_("remote host and port information (%s, %s) invalid"), remotehostname, remotepname); +#endif *hard_error = true; return INVALID_HANDLE; } -- cgit v1.2.3