diff --git a/acinclude.m4 b/acinclude.m4
index 8730a83757a4f19583137ac2ce6dab94f736ef5e..439961f5dd268f79c529eaae1df9f67f6e811b7a 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -64,7 +64,7 @@ dnl the code was bad, try a different program now, test 3
 ],[
 /* ioctlsocket source code */
  int socket;
- int flags = ioctlsocket(socket, FIONBIO, &flags);
+ unsigned long flags = ioctlsocket(socket, FIONBIO, &flags);
 ],[
 dnl ioctlsocket test was good
 nonblock="ioctlsocket"
diff --git a/lib/connect.c b/lib/connect.c
index 0d42ca14dcc40c39455f1e83b949eab6c340e483..b58a8be5d34b55ddda999f72c03f114e4d43a7cc 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -147,7 +147,7 @@ int Curl_nonblock(curl_socket_t sockfd,    /* operate on this */
 
 #ifdef HAVE_IOCTLSOCKET
   /* Windows? */
-  int flags;
+  unsigned long flags;
   flags = nonblock;
   return ioctlsocket(sockfd, FIONBIO, &flags);
 #define SETBLOCK 3