1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

w32: Fix use of assuan_sendfd.

* kbx/kbx-client-util.c (prepare_data_pipe): Use _get_osfhandle
for pipe to be used for sentfd.
[HAVE_W32_SYSTEM] (datastream_thread): Add the case of NREAD==0.
* tools/gpg-connect-agent.c (do_sendfd): Use es_syshd instead
of es_fileno.
[HAVE_W32_SYSTEM] (do_open): Use %p for formating HANDLE.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-06-01 09:10:14 +09:00
parent 6ed61d98a0
commit 0fba0bbc62
No known key found for this signature in database
GPG key ID: 640114AF89DE6054
2 changed files with 53 additions and 17 deletions

View file

@ -118,10 +118,14 @@ prepare_data_pipe (kbx_client_data_t kcd)
return err; /* That should not happen. */
}
err = assuan_sendfd (kcd->ctx, INT2FD (inpipe[1]));
#ifdef HAVE_W32_SYSTEM
err = assuan_sendfd (kcd->ctx, INT2FD (_get_osfhandle (inpipe[1])));
#else
err = assuan_sendfd (kcd->ctx, inpipe[1]);
#endif
if (err)
{
log_error ("sending sending fd %d to keyboxd: %s <%s>\n",
log_error ("sending fd %d to keyboxd: %s <%s>\n",
inpipe[1], gpg_strerror (err), gpg_strsource (err));
es_fclose (infp);
gnupg_close_pipe (inpipe[1]);
@ -193,6 +197,13 @@ datastream_thread (void *arg)
gnupg_sleep (1);
continue;
}
#ifdef HAVE_W32_SYSTEM
if (nread == 0)
{
gnupg_sleep (1);
continue;
}
#endif
if (nread != 4)
{
err = gpg_error (GPG_ERR_EIO);