From a64411c607d5450e786c3207b9023394574c979b Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 24 Jul 2019 14:27:47 +0900 Subject: [PATCH] common,w32: Fix cast from gnupg_fd_t to call _open_osfhandle. * common/sysutils.c (translate_sys2libc_fd): Use intptr_t. (gnupg_tmpfile): Likewise. Signed-off-by: NIIBE Yutaka --- common/sysutils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/sysutils.c b/common/sysutils.c index 0a3dc2eaf..f2abd924e 100644 --- a/common/sysutils.c +++ b/common/sysutils.c @@ -380,7 +380,7 @@ translate_sys2libc_fd (gnupg_fd_t fd, int for_write) /* Note that _open_osfhandle is currently defined to take and return a long. */ - x = _open_osfhandle ((long)fd, for_write ? 1 : 0); + x = _open_osfhandle ((intptr_t)fd, for_write ? 1 : 0); if (x == -1) log_error ("failed to translate osfhandle %p\n", (void *) fd); return x; @@ -511,7 +511,7 @@ gnupg_tmpfile (void) int fd = (int)file; fp = _wfdopen (fd, L"w+b"); #else - int fd = _open_osfhandle ((long)file, 0); + int fd = _open_osfhandle ((intptr_t)file, 0); if (fd == -1) { CloseHandle (file);