diff --git a/core/libs/prx/libScePosixForWebKit/Resolver.cpp b/core/libs/prx/libScePosixForWebKit/Resolver.cpp index 277290301..6441693f4 100644 --- a/core/libs/prx/libScePosixForWebKit/Resolver.cpp +++ b/core/libs/prx/libScePosixForWebKit/Resolver.cpp @@ -286,13 +286,13 @@ int APS5_VABI getnameinfo_nid_postfix(const void* address, std::uint32_t length, const char* APS5_VABI gai_strerror_nid_postfix(int error) { static const char* messages[] = { "Success", "Address family for hostname not supported", "Temporary failure in name resolution", - "Invalid flags", "Name resolution failed", "Address family not supported", - "Memory allocation failed", "No address for hostname", "Name or service not known", - "Service not supported for socket type", "Socket type not supported", "System error", - "Invalid hints", "Unknown protocol", "Buffer too small" + "Invalid value for ai_flags", "Non-recoverable failure in name resolution", "ai_family not supported", + "Memory allocation failure", "No address associated with hostname", "hostname nor servname provided, or not known", + "servname not supported for ai_socktype", "ai_socktype not supported", "System error returned in errno", + "Invalid value for hints", "Resolved protocol is unknown", "Argument buffer overflow" }; if (error < 0 || error >= static_cast(sizeof(messages) / sizeof(messages[0]))) - return "Unknown address resolution error"; + return "Unknown error"; return messages[error]; } } diff --git a/core/libs/tests/GuestResolver.cpp b/core/libs/tests/GuestResolver.cpp index 33bbed3d4..20f02e1d1 100644 --- a/core/libs/tests/GuestResolver.cpp +++ b/core/libs/tests/GuestResolver.cpp @@ -113,8 +113,13 @@ int main() { Require(getnameinfo_nid_postfix(v4.data(), 2, host, sizeof(host), nullptr, 0, 10) == 5); Require(getnameinfo_nid_postfix(v4.data(), v4.size(), host, sizeof(host), nullptr, 0, 32) == 3); Require(getnameinfo_nid_postfix(v4.data(), v4.size(), host, 1, nullptr, 0, 10) == 14); - Require(std::strlen(gai_strerror_nid_postfix(14)) > 0); - Require(std::strstr(gai_strerror_nid_postfix(-1), "Unknown") != nullptr); + Require(std::strcmp(gai_strerror_nid_postfix(0), "Success") == 0); + Require(std::strcmp(gai_strerror_nid_postfix(3), "Invalid value for ai_flags") == 0); + Require(std::strcmp(gai_strerror_nid_postfix(8), "hostname nor servname provided, or not known") == 0); + Require(std::strcmp(gai_strerror_nid_postfix(10), "ai_socktype not supported") == 0); + Require(std::strcmp(gai_strerror_nid_postfix(14), "Argument buffer overflow") == 0); + Require(std::strcmp(gai_strerror_nid_postfix(-1), "Unknown error") == 0); + Require(std::strcmp(gai_strerror_nid_postfix(15), "Unknown error") == 0); GuestResolver::AddressInfo hints{}; hints.flags = 12; // numeric host and service: no external DNS dependency hints.socketType = 1;