com php-src: Avoid calling select if maxfd returned by curl_multi_fdset is -1: ext/curl/multi.c
| From: | Pierrick Charron | Date: | Sat, 22 Sep 2012 14:15:40 +0000 |
| Subject: | com php-src: Avoid calling select if maxfd returned by curl_multi_fdset is -1: ext/curl/multi.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-70217@lists.php.net to get a copy of this message | ||
Commit: 2e8ab65270e7d1ebe1ef0dfe13836c29d72c7010
Author: Pierrick Charron <pierrick@php.net> Sat, 22 Sep 2012 10:15:40 -0400
Parents: 46458c2c65b7eec1fbe07dedd97fb6990843f3d6
Branches: PHP-5.3 PHP-5.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2e8ab65270e7d1ebe1ef0dfe13836c29d72c7010
Log:
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().
Changed paths:
M ext/curl/multi.c
Diff:
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index 034aa65..53e97b8 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));
}
/* }}} */