gpgme-tool: Support use of Windows HANDLE for INPUT/OUTPUT/MESSAGE.

* src/gpgme-tool.c [HAVE_W32_SYSTEM] (server_data_obj): Implement for
Windows HANDLE.

--

GnuPG-bug-id: 6634
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-09-29 11:01:50 +09:00
parent d43d787e9a
commit 8ad22290df
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -1909,7 +1909,19 @@ server_data_obj (assuan_fd_t fd, char *fn, int out,
err = gpgme_data_new_from_stream (data, *fs); err = gpgme_data_new_from_stream (data, *fs);
} }
else else
err = gpgme_data_new_from_fd (data, (int) fd); {
int posix_fd;
#if defined(HAVE_W32_SYSTEM)
posix_fd = _open_osfhandle ((intptr_t)fd, out ? 1 : 0);
if (posix_fd == -1)
return gpg_error_from_syserror ();
#else
posix_fd = fd;
#endif
err = gpgme_data_new_from_fd (data, posix_fd);
}
if (err) if (err)
return err; return err;