From 5b63f3526de4074b65ddace50908b3a447001269 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 5 Aug 2025 09:39:35 +0900 Subject: [PATCH] core/iwasm/libraries/lib-socket/test/nslookup.c: use gai_strerror (#4532) --- core/iwasm/libraries/lib-socket/test/nslookup.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/iwasm/libraries/lib-socket/test/nslookup.c b/core/iwasm/libraries/lib-socket/test/nslookup.c index 8e64d06be..2e42ef845 100644 --- a/core/iwasm/libraries/lib-socket/test/nslookup.c +++ b/core/iwasm/libraries/lib-socket/test/nslookup.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -28,6 +29,15 @@ test_nslookup(int af) hints.ai_family = af; hints.ai_socktype = SOCK_STREAM; int ret = getaddrinfo(url, 0, &hints, &res); + if (ret != 0) { + if (ret == EAI_SYSTEM) { + fprintf(stderr, "getaddrinfo failed: %s (%s)\n", gai_strerror(ret), + strerror(errno)); + } + else { + fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(ret)); + } + } assert(ret == 0); struct addrinfo *address = res; while (address) {