diff options
author | NIIBE Yutaka <[email protected]> | 2023-09-29 02:01:50 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-09-29 02:12:13 +0000 |
commit | 8ad22290df34c73881f42f02cdd28551ec265077 (patch) | |
tree | 379c4857608cfdce31f727f03185d5b5786aeb65 | |
parent | qt: Use UTF-8 for file names on Windows (diff) | |
download | gpgme-8ad22290df34c73881f42f02cdd28551ec265077.tar.gz gpgme-8ad22290df34c73881f42f02cdd28551ec265077.zip |
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 <[email protected]>
-rw-r--r-- | src/gpgme-tool.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index 7d3ca16d..0aa24510 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -1909,7 +1909,19 @@ server_data_obj (assuan_fd_t fd, char *fn, int out, err = gpgme_data_new_from_stream (data, *fs); } 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) return err; |