1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 02:02:32 +01:00

MFH: select usage fix

This commit is contained in:
Wez Furlong
2004-09-28 09:30:20 +00:00
parent a540196a41
commit 797cda2555

View File

@@ -533,7 +533,7 @@ static int php_sock_array_to_fd_set(zval *sock_array, fd_set *fds, PHP_SOCKET *m
php_sock = (php_socket*) zend_fetch_resource(element TSRMLS_CC, -1, le_socket_name, NULL, 1, le_socket);
if (!php_sock) continue; /* If element is not a resource, skip it */
FD_SET(php_sock->bsd_socket, fds);
PHP_SAFE_FD_SET(php_sock->bsd_socket, fds);
if (php_sock->bsd_socket > *max_fd) {
*max_fd = php_sock->bsd_socket;
}
@@ -560,7 +560,7 @@ static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds TSRMLS_DC)
php_sock = (php_socket*) zend_fetch_resource(element TSRMLS_CC, -1, le_socket_name, NULL, 1, le_socket);
if (!php_sock) continue; /* If element is not a resource, skip it */
if (FD_ISSET(php_sock->bsd_socket, fds)) {
if (PHP_SAFE_FD_ISSET(php_sock->bsd_socket, fds)) {
/* Add fd to new array */
zend_hash_next_index_insert(new_hash, (void *)element, sizeof(zval *), (void **)&dest_element);
if (dest_element) zval_add_ref(dest_element);
@@ -605,6 +605,8 @@ PHP_FUNCTION(socket_select)
RETURN_FALSE;
}
PHP_SAFE_MAX_FD(max_fd, 0); /* someone needs to make this look more like stream_socket_select */
/* If seconds is not set to null, build the timeval, else we wait indefinitely */
if (sec != NULL) {
zval tmp;