cURL / Mailing Lists / curl-library / Single Mail

curl-library

Patch: Avoid disallowed argument pattern of select() on WinSock

From: Brad Spencer <bspencer_at_blackberry.com>
Date: Tue, 27 May 2014 13:37:53 -0300

The current WinSock API documentation for select() states:

"Any two of the parameters, readfds, writefds, or exceptfds, can be
given as null. At least one must be non-null, and any non-null
descriptor set must contain at least one handle to a socket."

http://msdn.microsoft.com/en-ca/library/windows/desktop/ms740141(v=vs.85).aspx

When using select(), cURL doesn't adhere to this (WinSock-specific)
rule, and can ask to monitor empty fd_sets, which leads to select()
returning WSAEINVAL (i.e. EINVAL) and connections failing in mysterious
ways as a result (at least when using the curl_multi_socket_action()
interface).

The attached patch (against 7.37.0) changes how select() is called when
USE_WINSOCK is defined to conform to the above rule.

-- 
Brad Spencer


-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2014-05-27