Skip to content

Commit

Permalink
net/Resolver: use gai_strerrorA() on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Sep 2, 2024
1 parent b1801ee commit d8e8917
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/net/Resolver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ Resolve(const char *node, const char *service,
{
struct addrinfo *ai;
int error = getaddrinfo(node, service, hints, &ai);
if (error != 0)
if (error != 0) {
#ifdef _WIN32
const char *msg = gai_strerrorA(error);
#else
const char *msg = gai_strerror(error);
#endif
throw FmtRuntimeError("Failed to resolve {:?}:{:?}: {}",
node == nullptr ? "" : node,
service == nullptr ? "" : service,
gai_strerror(error));
msg);
}

return AddressInfoList(ai);
}
Expand Down

0 comments on commit d8e8917

Please sign in to comment.