diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2017-08-28 22:10:08 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2017-08-28 22:10:08 +0300 |
commit | 834c4e7da954326f385a2bce21e963e3063e145a (patch) | |
tree | f3d1202e100f168aa286581c7bff9861583c216f | |
parent | 3dc121c0569474fc156e2bdef809fb486a595fc9 (diff) | |
download | egawk-834c4e7da954326f385a2bce21e963e3063e145a.tar.gz egawk-834c4e7da954326f385a2bce21e963e3063e145a.tar.bz2 egawk-834c4e7da954326f385a2bce21e963e3063e145a.zip |
Use gai_strerror for error messages if getaddrinfo fails.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | configh.in | 3 | ||||
-rwxr-xr-x | configure | 3 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | io.c | 10 | ||||
-rw-r--r-- | test/ChangeLog | 4 | ||||
-rw-r--r-- | test/nonfatal1.ok | 2 |
7 files changed, 28 insertions, 3 deletions
@@ -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, @@ -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 @@ -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 \ @@ -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 |