diff --git a/src/anchor.c b/src/anchor.c index f50c4a3d..fc357b64 100644 --- a/src/anchor.c +++ b/src/anchor.c @@ -551,7 +551,11 @@ static void tas_rinse(getdns_context *context, tas_connection *a) GETDNS_CLEAR_EVENT(a->loop, &a->event); a->event.ev = NULL; if (a->fd >= 0) +#ifdef USE_WINSOCK + closesocket(a->fd); +#else close(a->fd); +#endif a->fd = -1; if (a->xml.data) GETDNS_FREE(context->mf, a->xml.data); @@ -662,7 +666,11 @@ static void tas_reconnect_cb(void *userarg) , "Waiting for second document timeout. Reconnecting...\n"); GETDNS_CLEAR_EVENT(a->loop, &a->event); +#ifdef USE_WINSOCK + closesocket(a->fd); +#else close(a->fd); +#endif a->fd = -1; if (a->state == TAS_READ_PS7_HDR) { a->state = TAS_RETRY; @@ -778,7 +786,11 @@ static void tas_read_cb(void *userarg) if (n == 0) { DEBUG_ANCHOR("Connection closed\n"); GETDNS_CLEAR_EVENT(a->loop, &a->event); +#ifdef USE_WINSOCK + closesocket(a->fd); +#else close(a->fd); +#endif a->fd = -1; if (a->state == TAS_READ_PS7_HDR) { a->state = TAS_RETRY; diff --git a/src/compat/mkstemp.c b/src/compat/mkstemp.c index 49d3e919..86d1dfd6 100644 --- a/src/compat/mkstemp.c +++ b/src/compat/mkstemp.c @@ -30,14 +30,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include #include +#include #include +#include int mkstemp(char *template) { if (_mktemp_s(template, strlen(template) + 1) != 0) return -1; - return open(template, _O_CREAT | _O_EXCL | _O_RDWR, _S_IWRITE | _S_IREAD); + return _open(template, _O_CREAT | _O_EXCL | _O_RDWR, _S_IWRITE | _S_IREAD); } diff --git a/src/gldns/parse.c b/src/gldns/parse.c index 367fa80f..c107c0df 100644 --- a/src/gldns/parse.c +++ b/src/gldns/parse.c @@ -13,7 +13,7 @@ #include "gldns/gbuffer.h" #include -#include +#include gldns_lookup_table gldns_directive_types[] = { { GLDNS_DIR_TTL, "$TTL" }, diff --git a/src/gldns/parseutil.c b/src/gldns/parseutil.c index 293496a9..1e436789 100644 --- a/src/gldns/parseutil.c +++ b/src/gldns/parseutil.c @@ -14,7 +14,9 @@ #include "config.h" #include "gldns/parseutil.h" +#ifdef HAVE_SYS_TIME_H #include +#endif #include #include diff --git a/src/stub.c b/src/stub.c index ee319312..ab393885 100644 --- a/src/stub.c +++ b/src/stub.c @@ -903,8 +903,13 @@ stub_tcp_write(int fd, getdns_tcp_state *tcp, getdns_network_req *netreq) just fall back to a 'normal' write. */ if (written == -1 && _getdns_socketerror() == _getdns_EISCONN) +#ifdef USE_WINSOCK + written = send(fd, (const char *)(netreq->query - 2) + , pkt_len + 2, 0); +#else written = write(fd, netreq->query - 2 , pkt_len + 2); +#endif } else written = send(fd, (const char *)(netreq->query - 2) , pkt_len + 2, 0);