summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierrick Charron <pierrick@php.net>2012-09-22 10:15:40 -0400
committerPierrick Charron <pierrick@php.net>2012-09-22 10:15:40 -0400
commit2e8ab65270e7d1ebe1ef0dfe13836c29d72c7010 (patch)
treec98ce4511bfbdb917b2d9b2d2a710aadf9171ec5
parent46458c2c65b7eec1fbe07dedd97fb6990843f3d6 (diff)
downloadphp-git-2e8ab65270e7d1ebe1ef0dfe13836c29d72c7010.tar.gz
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().
-rw-r--r--ext/curl/multi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index 034aa65c28..53e97b80f8 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -191,6 +191,9 @@ PHP_FUNCTION(curl_multi_select)
FD_ZERO(&exceptfds);
curl_multi_fdset(mh->multi, &readfds, &writefds, &exceptfds, &maxfd);
+ if (maxfd == -1) {
+ RETURN_LONG(-1);
+ }
RETURN_LONG(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to));
}
/* }}} */