Skip to content

Commit 2e8ab65

Browse files
committed
Avoid calling select if maxfd returned by curl_multi_fdset is -1
As per libcurl documentation : When libcurl returns -1 in max_fd, it is because libcurl currently does something that isn't possible for your application to monitor with a socket and unfortunately you can then not know exactly when the current action is completed using select().
1 parent 46458c2 commit 2e8ab65

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ext/curl/multi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ PHP_FUNCTION(curl_multi_select)
191191
FD_ZERO(&exceptfds);
192192

193193
curl_multi_fdset(mh->multi, &readfds, &writefds, &exceptfds, &maxfd);
194+
if (maxfd == -1) {
195+
RETURN_LONG(-1);
196+
}
194197
RETURN_LONG(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to));
195198
}
196199
/* }}} */

0 commit comments

Comments
 (0)