UDNS Windows compatibility changes

For some reason the config file doesn't generate with WINDOWS defined on my system.
This commit is contained in:
Richard Harrison 2019-06-08 15:49:15 +02:00
parent a68c4e9434
commit 4f6e72de55
3 changed files with 8 additions and 8 deletions

View File

@ -24,7 +24,7 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#ifdef WINDOWS #if defined(_WINDOWS) || defined(WINDOWS)
# include <winsock2.h> /* includes <windows.h> */ # include <winsock2.h> /* includes <windows.h> */
# include <iphlpapi.h> /* for dns server addresses etc */ # include <iphlpapi.h> /* for dns server addresses etc */
#else #else
@ -53,7 +53,7 @@ static void dns_set_srch_internal(struct dns_ctx *ctx, char *srch) {
dns_add_srch(ctx, srch); dns_add_srch(ctx, srch);
} }
#ifdef WINDOWS #if defined(_WINDOWS) || defined(WINDOWS)
#ifndef NO_IPHLPAPI #ifndef NO_IPHLPAPI
/* Apparently, some systems does not have proper headers for IPHLPAIP to work. /* Apparently, some systems does not have proper headers for IPHLPAIP to work.
@ -217,7 +217,7 @@ int dns_init(struct dns_ctx *ctx, int do_open) {
ctx = &dns_defctx; ctx = &dns_defctx;
dns_reset(ctx); dns_reset(ctx);
#ifdef WINDOWS #if defined(_WINDOWS) || defined(WINDOWS)
if (dns_initns_iphlpapi(ctx) != 0) if (dns_initns_iphlpapi(ctx) != 0)
dns_initns_registry(ctx); dns_initns_registry(ctx);
/*XXX WINDOWS: probably good to get default domain and search list too... /*XXX WINDOWS: probably good to get default domain and search list too...

View File

@ -24,7 +24,7 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#ifdef WINDOWS #if defined(_WINDOWS) || defined(WINDOWS)
# include <winsock2.h> /* includes <windows.h> */ # include <winsock2.h> /* includes <windows.h> */
# include <ws2tcpip.h> /* needed for struct in6_addr */ # include <ws2tcpip.h> /* needed for struct in6_addr */
#else #else
@ -392,7 +392,7 @@ dns_set_tmcbck(struct dns_ctx *ctx, dns_utm_fn *fn, void *data) {
} }
static unsigned dns_nonrandom_32(void) { static unsigned dns_nonrandom_32(void) {
#ifdef WINDOWS #if defined(_WINDOWS) || defined(WINDOWS)
FILETIME ft; FILETIME ft;
GetSystemTimeAsFileTime(&ft); GetSystemTimeAsFileTime(&ft);
return ft.dwLowDateTime; return ft.dwLowDateTime;
@ -551,7 +551,7 @@ int dns_open(struct dns_ctx *ctx) {
ctx->dnsc_qstatus = DNS_E_TEMPFAIL; ctx->dnsc_qstatus = DNS_E_TEMPFAIL;
return -1; return -1;
} }
#ifdef WINDOWS #if defined(_WINDOWS) || defined(WINDOWS)
{ unsigned long on = 1; { unsigned long on = 1;
if (ioctlsocket(sock, FIONBIO, &on) == SOCKET_ERROR) { if (ioctlsocket(sock, FIONBIO, &on) == SOCKET_ERROR) {
closesocket(sock); closesocket(sock);
@ -991,7 +991,7 @@ again: /* receive the reply */
* or remote. On local errors, we should stop, while * or remote. On local errors, we should stop, while
* remote errors should be ignored (for now anyway). * remote errors should be ignored (for now anyway).
*/ */
#ifdef WINDOWS #if defined(_WINDOWS) || defined(WINDOWS)
if (WSAGetLastError() == WSAEWOULDBLOCK) if (WSAGetLastError() == WSAEWOULDBLOCK)
#else #else
if (errno == EAGAIN) if (errno == EAGAIN)

View File

@ -27,7 +27,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
#ifndef WINDOWS #if !defined(_WINDOWS) && !defined(WINDOWS)
# include <sys/types.h> # include <sys/types.h>
# include <netinet/in.h> # include <netinet/in.h>
#endif #endif