git: 631b82aca0fd - main - fetch: support EAI_ADDRFAMILY error, correct two error messages
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Nov 2022 16:04:31 UTC
The branch main has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=631b82aca0fd41c8e0d48eebdb9c4e38b7306472 commit 631b82aca0fd41c8e0d48eebdb9c4e38b7306472 Author: Mike Karels <karels@FreeBSD.org> AuthorDate: 2022-11-02 15:59:09 +0000 Commit: Mike Karels <karels@FreeBSD.org> CommitDate: 2022-11-02 16:03:31 +0000 fetch: support EAI_ADDRFAMILY error, correct two error messages With the change to return EAI_ADDRFAMILY from getaddrinfo(), fetch would print "Unknown resolver error" for that error. Add that error and its string to libfetch's table, using an #ifdef just in case. Correct error strings for EAI_NODATA (although it is currently unused) and EAI_NONAME. Should maybe rework the code to use gai_strerror(3), but that doesn't map directly, and the current strings are shortened. Reviewed in https://reviews.freebsd.org/D37139 with related changes. Reviewed by: bz MFC after: 1 month --- lib/libfetch/common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index 47545e5178c3..7bf487b0db1d 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -67,12 +67,15 @@ __FBSDID("$FreeBSD$"); * Error messages for resolver errors */ static struct fetcherr netdb_errlist[] = { +#ifdef EAI_ADDRFAMILY + { EAI_ADDRFAMILY, FETCH_RESOLV, "Address family for host not supported" }, +#endif #ifdef EAI_NODATA - { EAI_NODATA, FETCH_RESOLV, "Host not found" }, + { EAI_NODATA, FETCH_RESOLV, "No address for host" }, #endif { EAI_AGAIN, FETCH_TEMP, "Transient resolver failure" }, { EAI_FAIL, FETCH_RESOLV, "Non-recoverable resolver failure" }, - { EAI_NONAME, FETCH_RESOLV, "No address record" }, + { EAI_NONAME, FETCH_RESOLV, "Host does not resolve" }, { -1, FETCH_UNKNOWN, "Unknown resolver error" } };