From ea09baf376858a5ac1524d8d71e7505d8307b2ca Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Tue, 29 Oct 2019 17:42:21 +0000 Subject: [PATCH] Fix Windows build failure when libunbound is present. --- src/context.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/context.c b/src/context.c index 8d9a1443..2f190129 100644 --- a/src/context.c +++ b/src/context.c @@ -2395,7 +2395,15 @@ getdns_context_set_dns_root_servers( { #ifdef HAVE_LIBUNBOUND # ifndef HAVE_UB_CTX_SET_STUB - char tmpfn[FILENAME_MAX] = P_tmpdir "/getdns-root-dns-servers-XXXXXX"; + char tmpfn[FILENAME_MAX]; + +# ifdef USE_WINSOCK + GetTempPathA(FILENAME_MAX, tmpfn); + strncat_s(tmpfn, FILENAME_MAX, "/getdns-root-dns-servers-XXXXXX", _TRUNCATE); +# else + strlcpy(tmpfn, P_tmpdir "/getdns-root-dns-servers-XXXXXX", FILENAME_MAX); +# endif + FILE *fh; int fd; size_t dst_len;