From a5f1d6734b7a1aafa818405c9bc56460dd412b4d Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Sun, 1 Dec 2024 17:17:09 +0100 Subject: [PATCH] Fix format-truncation warning Found by: Geo Patch by: michaelortmann --- src/dns.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]);