diff --git a/src/dns.c b/src/dns.c index 863d40c33..a47f53bcf 100644 --- a/src/dns.c +++ b/src/dns.c @@ -565,7 +565,8 @@ void *thread_dns_ipbyhost(void *arg) else if (error == EAI_NONAME) snprintf(dtn->strerror, sizeof dtn->strerror, "dns: thread_dns_ipbyhost(): getaddrinfo(): not known"); else if (error == EAI_SYSTEM) { - snprintf(dtn->strerror, sizeof dtn->strerror, "dns: thread_dns_ipbyhost(): getaddrinfo(): %s: %s", gai_strerror(error), strerror(errno)); + /* print raw errno, dont use strerror() in thread and dont use strerror_r() due to GNU / POSIX portability complexity */ + snprintf(dtn->strerror, sizeof dtn->strerror, "dns: thread_dns_ipbyhost(): getaddrinfo(): %s: errno %i", gai_strerror(error), errno); } else snprintf(dtn->strerror, sizeof dtn->strerror, "dns: thread_dns_ipbyhost(): getaddrinfo(): %s", gai_strerror(error)); close(dtn->fildes[1]);