cURL / Mailing Lists / curl-library / Single Mail


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

From: Brad Spencer <>
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."

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()

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:

Received on 2014-05-27