1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-04-17 15:44:34 +02:00

Fix for return value of ConnectNamedPipe.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2022-07-28 10:48:17 +09:00
parent 6f9bb301b7
commit eb8725b195

View File

@ -2808,15 +2808,15 @@ win32_openssh_thread (void *arg)
if (pipe == INVALID_HANDLE_VALUE) if (pipe == INVALID_HANDLE_VALUE)
{ {
npth_protect (); npth_protect ();
log_error ("cannot create pipe: %ld\n", GetLastError()); log_error ("cannot create pipe: %ld\n", GetLastError ());
break; break;
} }
if (ConnectNamedPipe (pipe, NULL) != FALSE) if (ConnectNamedPipe (pipe, NULL) == 0)
{ {
npth_protect (); npth_protect ();
CloseHandle (pipe); CloseHandle (pipe);
log_error ("ConnectNamedPipe returned TRUE unexpectedly\n"); log_error ("Error at ConnectNamedPipe: %ld\n", GetLastError ());
break; break;
} }
@ -2844,7 +2844,7 @@ win32_openssh_thread (void *arg)
syshd.type = ES_SYSHD_HANDLE; syshd.type = ES_SYSHD_HANDLE;
syshd.u.handle = pipe; syshd.u.handle = pipe;
ssh_stream = es_sysopen (&syshd, "r+"); ssh_stream = es_sysopen (&syshd, "r+b");
if (!ssh_stream) if (!ssh_stream)
{ {
agent_deinit_default_ctrl (ctrl); agent_deinit_default_ctrl (ctrl);