summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2022-03-30 04:44:06 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2022-03-30 04:44:06 +0200
commit2189b4bb638cd56fbb941353ecbfc373cb4cf90b (patch)
tree9a7c80e16845d60b2a0b29709bf9e9023396a92f
parentdirmngr: Clean up for not supporting WindowsCE. (diff)
downloadgnupg2-2189b4bb638cd56fbb941353ecbfc373cb4cf90b.tar.xz
gnupg2-2189b4bb638cd56fbb941353ecbfc373cb4cf90b.zip
common,w32: Fix handle_to_fd to match use of _open_osfhandle.
* common/exechelp-w32.c (handle_to_fd): Use intptr_t. (gnupg_wait_processes): Fix to use pid_to_handle. -- Both of original MinGW and MinGW-W64 use intptr_t for the first argument of _open_osfhandle. So, intptr_t is better here. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to '')
-rw-r--r--common/exechelp-w32.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/common/exechelp-w32.c b/common/exechelp-w32.c
index 9529c57a0..19cf85c85 100644
--- a/common/exechelp-w32.c
+++ b/common/exechelp-w32.c
@@ -77,12 +77,11 @@
#undef X_OK
#define X_OK F_OK
-/* We assume that a HANDLE can be represented by an int which should
- be true for all i386 systems (HANDLE is defined as void *) and
- these are the only systems for which Windows is available. Further
- we assume that -1 denotes an invalid handle. */
+/* We assume that a HANDLE can be represented by an intptr_t which
+ should be true for all systems (HANDLE is defined as void *).
+ Further we assume that -1 denotes an invalid handle. */
# define fd_to_handle(a) ((HANDLE)(a))
-# define handle_to_fd(a) ((int)(a))
+# define handle_to_fd(a) ((intptr_t)(a))
# define pid_to_handle(a) ((HANDLE)(a))
# define handle_to_pid(a) ((int)(a))
@@ -808,7 +807,7 @@ gnupg_wait_processes (const char **pgmnames, pid_t *pids, size_t count,
if (pids[i] == (pid_t)(-1))
return my_error (GPG_ERR_INV_VALUE);
- procs[i] = fd_to_handle (pids[i]);
+ procs[i] = pid_to_handle (pids[i]);
}
/* FIXME: We should do a pth_waitpid here. However this has not yet