aboutsummaryrefslogtreecommitdiffstats
path: root/common/exectool.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2017-02-28 08:34:29 +0000
committerWerner Koch <[email protected]>2017-02-28 08:39:10 +0000
commit1192449207f41b26be8950b04df84a52c8a2a886 (patch)
tree66bc2f2e39c4f1be9cb39fea9225d8a07db0f6c9 /common/exectool.c
parentdirmngr: Avoid warnings during non-ntbtls build. (diff)
downloadgnupg-1192449207f41b26be8950b04df84a52c8a2a886.tar.gz
gnupg-1192449207f41b26be8950b04df84a52c8a2a886.zip
w32: Make pipes really pollable.
* common/exectool.c (gnupg_exec_tool_stream) [W32]: Use _get_osfhandle to print the fd for the command line. * common/exechelp-w32.c (create_pipe_and_estream): Use es_sysopen so that the streams are actually pollable. -- This addresses two bugs: - Using the "-&@INEXTRA@" kludges requires that we pass the value of the handle on the command line and not the libc fd. - gpgrt_poll requires the use of the ReadFile/WriteFile backend which is currently only used when the stream has been created with gpgrt_sysopen. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'common/exectool.c')
-rw-r--r--common/exectool.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/exectool.c b/common/exectool.c
index ed8225ad4..c9e00205a 100644
--- a/common/exectool.c
+++ b/common/exectool.c
@@ -384,7 +384,12 @@ gnupg_exec_tool_stream (const char *pgmname, const char *argv[],
/* Now find the argument marker and replace by the pipe's fd.
Yeah, that is an ugly non-thread safe hack but it safes us to
create a copy of the array. */
+#ifdef HAVE_W32_SYSTEM
+ snprintf (extrafdbuf, sizeof extrafdbuf, "-&%lu",
+ (unsigned long)(void*)_get_osfhandle (extrapipe[0]));
+#else
snprintf (extrafdbuf, sizeof extrafdbuf, "-&%d", extrapipe[0]);
+#endif
for (argsaveidx=0; argv[argsaveidx]; argsaveidx++)
if (!strcmp (argv[argsaveidx], "-&@INEXTRA@"))
{