[Spice-devel] [PATCH] Fix = use instead of ==

Alon Levy alevy at redhat.com
Mon Feb 20 03:28:48 PST 2012


On Mon, Feb 20, 2012 at 11:53:14AM +0100, Christophe Fergeau wrote:
> When checking for ConnectNamedPipe status, the error check uses
> if ( err = ERROR_IO_PENDING) instead of using == which causes this
> error check to always trigger. This commit fixes this, however it
> needs careful testing since the fact that it went unnoticed means
> the code with the bug was working as expected. Maybe changing it
> will cause unexpected regressions.

Good catch. I think Arnon is not available today, only tomorrow.

> ---
>  vdservice/vdservice.cpp |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
> index 4f47678..4701f5a 100644
> --- a/vdservice/vdservice.cpp
> +++ b/vdservice/vdservice.cpp
> @@ -893,7 +893,7 @@ bool VDService::launch_agent()
>      ZeroMemory(&overlap, sizeof(overlap));
>      overlap.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
>      DWORD err = (ConnectNamedPipe(_pipe_state.pipe, &overlap) ? 0 : GetLastError());
> -    if (err = ERROR_IO_PENDING) {
> +    if (err == ERROR_IO_PENDING) {
>          HANDLE wait_handles[2] = {overlap.hEvent, _agent_proc_info.hProcess};
>          DWORD wait_ret = WaitForMultipleObjects(2, wait_handles, FALSE, VD_AGENT_TIMEOUT);
>          if (wait_ret != WAIT_OBJECT_0) {
> -- 
> 1.7.7.6
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list