aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--configh.in3
-rwxr-xr-xconfigure3
-rw-r--r--configure.ac3
-rw-r--r--io.c10
-rw-r--r--test/ChangeLog4
-rw-r--r--test/nonfatal1.ok2
7 files changed, 28 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 37315324..b4e60c51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,12 @@
* interpret.h (r_interpret): Add some casts to avoid warning
messages in printf statements.
+ Unrelated:
+
+ * configure.ac: Add check for gai_strerror.
+ * io.c (socketopen): Use gai_strerror to add more information
+ if getaddrinfo fails.
+
2017-08-25 Pat Rankin <r.pat.rankin@gmail.com>
* builtin.c (TYPE_MINIMUM): Use type uintmax_t for the calculation,
diff --git a/configh.in b/configh.in
index 4d5ce95e..e6000054 100644
--- a/configh.in
+++ b/configh.in
@@ -51,6 +51,9 @@
/* Define to 1 if you have the `fwrite_unlocked' function. */
#undef HAVE_FWRITE_UNLOCKED
+/* Define to 1 if you have the `gai_strerror' function. */
+#undef HAVE_GAI_STRERROR
+
/* have getaddrinfo */
#undef HAVE_GETADDRINFO
diff --git a/configure b/configure
index 7659863d..a7183ff8 100755
--- a/configure
+++ b/configure
@@ -9940,7 +9940,8 @@ $as_echo "$LIBSIGSEGV" >&6; }
esac
# Need the check for mkstemp and tmpfile for missing_d/snprintf.c.
-for ac_func in __etoa_l atexit btowc fmod getgrent getgroups grantpt \
+for ac_func in __etoa_l atexit btowc fmod gai_strerror \
+ getgrent getgroups grantpt \
fwrite_unlocked \
isascii iswctype iswlower iswupper mbrlen \
memcmp memcpy memcpy_ulong memmove memset \
diff --git a/configure.ac b/configure.ac
index 1a1fdac8..c4c2e437 100644
--- a/configure.ac
+++ b/configure.ac
@@ -290,7 +290,8 @@ osf1) : ;;
esac
# Need the check for mkstemp and tmpfile for missing_d/snprintf.c.
-AC_CHECK_FUNCS(__etoa_l atexit btowc fmod getgrent getgroups grantpt \
+AC_CHECK_FUNCS(__etoa_l atexit btowc fmod gai_strerror \
+ getgrent getgroups grantpt \
fwrite_unlocked \
isascii iswctype iswlower iswupper mbrlen \
memcmp memcpy memcpy_ulong memmove memset \
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;
}
diff --git a/test/ChangeLog b/test/ChangeLog
index 756386af..391828ae 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2017-08-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ * nonfatal1.ok: Update after code change.
+
2017-08-23 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (testext): Fix spelling of testexttmp.txt.
diff --git a/test/nonfatal1.ok b/test/nonfatal1.ok
index 51583f2c..4c9ab576 100644
--- a/test/nonfatal1.ok
+++ b/test/nonfatal1.ok
@@ -1,2 +1,2 @@
-gawk: nonfatal1.awk:4: warning: remote host and port information (local:host, 25) invalid
+gawk: nonfatal1.awk:4: warning: remote host and port information (local:host, 25) invalid: Name or service not known
1