aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32-io.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2025-12-23 08:17:29 +0100
committerNIIBE Yutaka <[email protected]>2025-12-23 08:26:42 +0100
commit936015d49c389a6cafc40025f7881625ded90120 (patch)
treec651447cd0e285e947c54059011ae79f0e7e0c4e /src/w32-io.c
parentFix a regression wrt the auto-key-locate option. (diff)
downloadgpgme-936015d49c389a6cafc40025f7881625ded90120.tar.gz
gpgme-936015d49c389a6cafc40025f7881625ded90120.zip
w32: Fix spawn for 64-bit machine.
* src/priv-io.h (struct spawn_fd_item_s): Use HANDLE for peer_name field. * src/dirinfo.c (read_gpgconf_dirs): Use ASSUAN_INVALID_FD for default value for peer_name field of CFD. * src/engine-gpgconf.c (gpgconf_read, gpgconf_write) (gpgconf_query_swdb): Likewise. * src/version.c (_gpgme_get_program_version): Likewise. * src/w32-io.c (handle_to_fd): Remove. (_gpgme_io_spawn): Assign HD to the peer_name field. Use %p for printing the value of peer_name field. * src/gpgme-w32spawn.c (my_spawn): Use peer_name field with no cast. Use %p for printing the value of peer_name field. Remove wrong CloseHandle calls. (translate_get_from_file): Use HANDLE type for the TO variable. Use strtoull on 64-bit machine. Use ASSUAN_INVALID_FD. -- Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'src/w32-io.c')
-rw-r--r--src/w32-io.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/w32-io.c b/src/w32-io.c
index 5fcaf78a..bd528276 100644
--- a/src/w32-io.c
+++ b/src/w32-io.c
@@ -47,8 +47,6 @@
* lower value and dynamically resize the table. */
#define MAX_SLAFD 512
-#define handle_to_fd(a) ((int)(a))
-
#define READBUF_SIZE 4096
#define WRITEBUF_SIZE 4096
#define PIPEBUF_SIZE 4096
@@ -1541,7 +1539,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
return TRACE_SYSRES (-1);
}
/* Return the child name of this handle. */
- fd_list[i].peer_name = handle_to_fd (hd);
+ fd_list[i].peer_name = hd;
}
/* Write the handle translation information to the temporary
@@ -1567,7 +1565,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
len = strlen (line) - 1;
/* Format is: Local name, stdin/stdout/stderr, peer name, argv idx. */
- snprintf (&line[len], BUFFER_MAX - len, "0x%x %d 0x%x %d \n",
+ snprintf (&line[len], BUFFER_MAX - len, "0x%x %d %p %d \n",
fd_list[i].fd, fd_list[i].dup_to,
fd_list[i].peer_name, fd_list[i].arg_loc);
/* Rather safe than sorry. */
@@ -1620,10 +1618,10 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
for (i = 0; fd_list[i].fd != -1; i++)
if (fd_list[i].dup_to == -1)
- TRACE_LOG ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd,
+ TRACE_LOG ("fd[%i] = 0x%x -> %p", i, fd_list[i].fd,
fd_list[i].peer_name);
else
- TRACE_LOG ("fd[%i] = 0x%x -> 0x%x (std%s)", i, fd_list[i].fd,
+ TRACE_LOG ("fd[%i] = 0x%x -> %p (std%s)", i, fd_list[i].fd,
fd_list[i].peer_name, (fd_list[i].dup_to == 0) ? "in" :
((fd_list[i].dup_to == 1) ? "out" : "err"));