summaryrefslogtreecommitdiff
path: root/lib/select.c
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2020-07-21 20:17:01 +0200
committerMarc Hoersken <info@marc-hoersken.de>2020-08-25 11:20:58 +0200
commite21bd22f842dc07ee953fac6a1edd0c054f123d4 (patch)
tree175094400aa66d8735a8f3eb7b0663706258250a /lib/select.c
parent0f7c332f9f36f792a7903760b2a8db45091ed8b6 (diff)
downloadcurl-e21bd22f842dc07ee953fac6a1edd0c054f123d4.tar.gz
select: fix poll-based check not detecting connect failure
This commit changes Curl_socket_check to use POLLPRI to check for connect failure on the write socket, because POLLPRI maps to fds_err. This is in line with select(2). The select-based socket check correctly checks for connect failures by adding the write socket also to fds_err. The poll-based implementation (which internally can itself fallback to select again) did not previously check for connect failure by using POLLPRI with the write socket. See the follow up commit to this for more information. This commit makes sure connect failures can be detected and handled if HAVE_POLL_FINE is defined, eg. on msys2-devel. Reviewed-by: Daniel Stenberg Reviewed-by: Jay Satiro Replaces #5509 Prepares #5707
Diffstat (limited to 'lib/select.c')
-rw-r--r--lib/select.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/select.c b/lib/select.c
index abb124ae8..3928b12dc 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -288,7 +288,7 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
}
if(writefd != CURL_SOCKET_BAD) {
pfd[num].fd = writefd;
- pfd[num].events = POLLWRNORM|POLLOUT;
+ pfd[num].events = POLLWRNORM|POLLOUT|POLLPRI;
pfd[num].revents = 0;
num++;
}
@@ -316,7 +316,7 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
if(writefd != CURL_SOCKET_BAD) {
if(pfd[num].revents & (POLLWRNORM|POLLOUT))
ret |= CURL_CSELECT_OUT;
- if(pfd[num].revents & (POLLERR|POLLHUP|POLLNVAL))
+ if(pfd[num].revents & (POLLERR|POLLHUP|POLLPRI|POLLNVAL))
ret |= CURL_CSELECT_ERR;
}