Fix reporting errors with gai_strerror(..)

The return value (`err`) should be checked; not the `errno` value.

PR:		235200
Approved by:	emaste (mentor)
Reviewed by:	asomers, lwhsu
MFC after:	28 days
MFC with:	r343362, r343365, r343367-r343368
Differential Revision: https://reviews.freebsd.org/D18969
This commit is contained in:
Enji Cooper 2019-01-26 03:43:12 +00:00
parent 771ec59bb7
commit 4ce7bd2527
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343461

View File

@ -114,7 +114,7 @@ resolve_localhost(struct addrinfo **res, int domain, int type, int port)
error = getaddrinfo("localhost", serv, &hints, res);
ATF_REQUIRE_EQ_MSG(error, 0,
"getaddrinfo failed: %s", gai_strerror(errno));
"getaddrinfo failed: %s", gai_strerror(error));
free(serv);
}