]> granicus.if.org Git - php/commitdiff
MFH: select usage fix
authorWez Furlong <wez@php.net>
Tue, 28 Sep 2004 09:30:20 +0000 (09:30 +0000)
committerWez Furlong <wez@php.net>
Tue, 28 Sep 2004 09:30:20 +0000 (09:30 +0000)
ext/sockets/sockets.c

index 8f2a329c353821b4a0a0371e7ea2794a743bf376..c9ac0b5dc85a978ba356743e3ee466e10ab8606f 100644 (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;