RE: [PHP-CVS] com php-src: Fix #74410 by calling WaitForMultipleObjects() instead of MsgWaitForMultipleObjects(): win32/select.c

[email protected] (Anatol Belski)
Newsgroups php.cvs
Message-ID <HE1PR02MB105245528AFC4A4479CAAEAFBA020@HE1PR02MB1052.eurprd02.prod.outlook.com>
Hi Matt,

> -----Original Message-----
> From: Matt Ficken [mailto:[email protected]]
> Sent: Tuesday, April 11, 2017 10:55 AM
> To: [email protected]
> Subject: [PHP-CVS] com php-src: Fix #74410 by calling WaitForMultipleObjects()
> instead of MsgWaitForMultipleObjects(): win32/select.c
> 
> Commit:    76c9b584319b75b203c7e1ed7ed82b7bdbe4c442
> Author:    Matt Ficken <[email protected]>         Tue, 11 Apr 2017 01:54:57 -
> 0700
> Parents:   7cdf520319b4c2dab1409215b680ee1410bf39c2
> Branches:  PHP-7.0 PHP-7.1 master
> 
> Link:       http://git.php.net/?p=php-
> src.git;a=commitdiff;h=76c9b584319b75b203c7e1ed7ed82b7bdbe4c442
> 
> Log:
> Fix #74410 by calling WaitForMultipleObjects() instead of
> MsgWaitForMultipleObjects()
> 
> Bugs:
> https://bugs.php.net/74410
> 
> Changed paths:
>   M  win32/select.c
> 
> 
> Diff:
> diff --git a/win32/select.c b/win32/select.c
> index b49de94..7060ebf 100644
> --- a/win32/select.c
> +++ b/win32/select.c
> @@ -67,13 +67,13 @@ PHPAPI int php_select(int max_fd, fd_set *rfds, fd_set
> *wfds, fd_set *efds, stru
>  			if (handles[n_handles] == INVALID_HANDLE_VALUE) {
>  				/* socket */
>  				if (SAFE_FD_ISSET(i, rfds)) {
> -					FD_SET((uint)i, &sock_read);
> +					FD_SET((uint32_t)i, &sock_read);
>  				}
>  				if (SAFE_FD_ISSET(i, wfds)) {
> -					FD_SET((uint)i, &sock_write);
> +					FD_SET((uint32_t)i, &sock_write);
>  				}
>  				if (SAFE_FD_ISSET(i, efds)) {
> -					FD_SET((uint)i, &sock_except);
> +					FD_SET((uint32_t)i, &sock_except);
>  				}
>  				if (i > sock_max_fd) {
>  					sock_max_fd = i;
> @@ -117,7 +117,7 @@ PHPAPI int php_select(int max_fd, fd_set *rfds, fd_set
> *wfds, fd_set *efds, stru
>  			/* check handles */
>  			DWORD wret;
> 
> -			wret = MsgWaitForMultipleObjects(n_handles, handles,
> FALSE, retcode > 0 ? 0 : 100, QS_ALLEVENTS);
> +			wret = WaitForMultipleObjects(n_handles, handles,
> FALSE, retcode > 0 ? 0 : 100);
> 
>  			if (wret == WAIT_TIMEOUT) {
>  				/* set retcode to 0; this is the default.
> @@ -136,13 +136,13 @@ PHPAPI int php_select(int max_fd, fd_set *rfds, fd_set
> *wfds, fd_set *efds, stru
>  				for (i = 0; i < n_handles; i++) {
>  					if (WAIT_OBJECT_0 ==
> WaitForSingleObject(handles[i], 0)) {
>  						if
> (SAFE_FD_ISSET(handle_slot_to_fd[i], rfds)) {
> -
> 	FD_SET((uint)handle_slot_to_fd[i], &aread);
> +
> 	FD_SET((uint32_t)handle_slot_to_fd[i], &aread);
>  						}
>  						if
> (SAFE_FD_ISSET(handle_slot_to_fd[i], wfds)) {
> -
> 	FD_SET((uint)handle_slot_to_fd[i], &awrite);
> +
> 	FD_SET((uint32_t)handle_slot_to_fd[i], &awrite);
>  						}
>  						if
> (SAFE_FD_ISSET(handle_slot_to_fd[i], efds)) {
> -
> 	FD_SET((uint)handle_slot_to_fd[i], &aexcept);
> +
> 	FD_SET((uint32_t)handle_slot_to_fd[i], &aexcept);
>  						}
>  						retcode++;
>  					}
> 
Please add also a NEWS entry in the stable branches, where the patch went in.

Thanks

Anatol
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.