diff options
| author | NIIBE Yutaka <[email protected]> | 2025-12-23 08:17:29 +0100 |
|---|---|---|
| committer | NIIBE Yutaka <[email protected]> | 2025-12-23 08:26:42 +0100 |
| commit | 936015d49c389a6cafc40025f7881625ded90120 (patch) | |
| tree | c651447cd0e285e947c54059011ae79f0e7e0c4e /src/gpgme-w32spawn.c | |
| parent | Fix a regression wrt the auto-key-locate option. (diff) | |
| download | gpgme-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/gpgme-w32spawn.c')
| -rw-r--r-- | src/gpgme-w32spawn.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/gpgme-w32spawn.c b/src/gpgme-w32spawn.c index 56918c96..b0d8a5cd 100644 --- a/src/gpgme-w32spawn.c +++ b/src/gpgme-w32spawn.c @@ -159,21 +159,21 @@ my_spawn (wchar_t **argv, struct spawn_fd_item_s *fd_list, unsigned int flags) /* The handle already is inheritable. */ if (fd_list[i].dup_to == 0) { - si.hStdInput = (HANDLE) fd_list[i].peer_name; + si.hStdInput = fd_list[i].peer_name; duped_stdin = 1; - fprintf (mystderr, PGM": dup 0x%x to stdin\n", fd_list[i].peer_name); + fprintf (mystderr, PGM": dup %p to stdin\n", fd_list[i].peer_name); } else if (fd_list[i].dup_to == 1) { - si.hStdOutput = (HANDLE) fd_list[i].peer_name; + si.hStdOutput = fd_list[i].peer_name; duped_stdout = 1; - fprintf (mystderr, PGM": dup 0x%x to stdout\n", fd_list[i].peer_name); + fprintf (mystderr, PGM": dup %p to stdout\n", fd_list[i].peer_name); } else if (fd_list[i].dup_to == 2) { - si.hStdError = (HANDLE) fd_list[i].peer_name; + si.hStdError = fd_list[i].peer_name; duped_stderr = 1; - fprintf (mystderr, PGM":dup 0x%x to stderr\n", fd_list[i].peer_name); + fprintf (mystderr, PGM":dup %p to stderr\n", fd_list[i].peer_name); } } @@ -234,9 +234,6 @@ my_spawn (wchar_t **argv, struct spawn_fd_item_s *fd_list, unsigned int flags) if (hnul != INVALID_HANDLE_VALUE) CloseHandle (hnul); - for (i = 0; fd_list[i].fd != -1; i++) - CloseHandle ((HANDLE) fd_list[i].fd); - if (flags & IOSPAWN_FLAG_ALLOW_SET_FG) { static int initialized; @@ -317,7 +314,7 @@ translate_get_from_file (const wchar_t *trans_file, { unsigned long from; long dup_to; - unsigned long to; + HANDLE to; unsigned long loc; char *tail; @@ -359,7 +356,11 @@ translate_get_from_file (const wchar_t *trans_file, linep++; if (*linep == '\0') break; - to = strtoul (linep, &tail, 0); +#if HAVE_W64_SYSTEM + to = (HANDLE)strtoull (linep, &tail, 0); +#else + to = (HANDLE)strtoul (linep, &tail, 0); +#endif if (tail == NULL || ! (*tail == '\0' || isspace (*tail))) break; linep = tail; @@ -380,7 +381,7 @@ translate_get_from_file (const wchar_t *trans_file, } fd_list[idx].fd = -1; fd_list[idx].dup_to = -1; - fd_list[idx].peer_name = -1; + fd_list[idx].peer_name = ASSUAN_INVALID_FD; fd_list[idx].arg_loc = 0; return 0; } |
