From f490acc5262c826602f15c1f2206602e0f293287 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Mon, 18 Mar 2013 23:15:29 -0500 Subject: [PATCH] Winsock connect returns WSAEWOULDBLOCK... ...instead of EINPROGRESS. And we get to call WSAGetLasteError() too boot :( --- lib/krb5/send_to_kdc.c | 4 ++++ lib/roken/roken.h.in | 3 +++ 2 files changed, 7 insertions(+) diff --git a/lib/krb5/send_to_kdc.c b/lib/krb5/send_to_kdc.c index 54b46d541..f79af011f 100644 --- a/lib/krb5/send_to_kdc.c +++ b/lib/krb5/send_to_kdc.c @@ -484,6 +484,10 @@ host_connect(krb5_context context, krb5_sendto_ctx ctx, struct host *host) debug_host(context, 5, host, "connecting to host"); if (connect(host->fd, ai->ai_addr, ai->ai_addrlen) < 0) { +#ifdef HAVE_WINSOCK + if (WSAGetLastError() == WSAEWOULDBLOCK) + errno = EINPROGRESS; +#endif /* HAVE_WINSOCK */ if (errno == EINPROGRESS && (hi->proto == KRB5_KRBHST_HTTP || hi->proto == KRB5_KRBHST_TCP)) { debug_host(context, 5, host, "connecting to %d", host->fd); host->state = CONNECTING; diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index 82c973b77..52a786c75 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -1175,6 +1175,9 @@ int ROKEN_LIB_FUNCTION rk_socket(int, int, int); #ifndef EAFNOSUPPORT #define EAFNOSUPPORT 102 #endif +#ifndef EINPROGRESS +#define EINPROGRESS 112 +#endif #ifndef ENOTSOCK #define ENOTSOCK 128 #endif