Skip to content

Commit

Permalink
New fix: print raw errno, dont use strerror() in thread and dont use …
Browse files Browse the repository at this point in the history
…strerror_r() due to GNU / POSIX portability complexity
  • Loading branch information
michaelortmann committed Aug 8, 2024
1 parent 9fd4b1f commit 3eeee5d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 3eeee5d

Please sign in to comment.