From 168212932fb696db116780a342b23cabbcc1b74e Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Mon, 18 May 2026 14:59:27 +0900 Subject: io:w32:spawn_sans_helper: Fix inherit of HANDLES to child process. * src/w32-io.c (_gpgme_io_spawn_sans_helper): Inherit HANDLES correctly, even when an argument is not modified. -- Fixes-commit: 64f80903ec9bc8897f9b2dcebb7068c02ff9ae07 GnuPG-bug-id: 7127 Signed-off-by: NIIBE Yutaka --- src/w32-io.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/w32-io.c b/src/w32-io.c index 48f2869f..c01d50eb 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -1474,13 +1474,6 @@ _gpgme_io_spawn_sans_helper (const char *path, char *const spawn_argv[], std_hd++; } - idx = fd_list[i].arg_loc; - if (idx == 0) - continue; - if (idx >= argc) - /* something goes wrong, ignore. */ - continue; - if (!std_hd) { if (inherit_hd < DIM (handles) - 1) @@ -1495,6 +1488,13 @@ _gpgme_io_spawn_sans_helper (const char *path, char *const spawn_argv[], } } + idx = fd_list[i].arg_loc; + if (idx == 0) + continue; + if (idx >= argc) + /* something goes wrong, ignore. */ + continue; + /* Fix the arg at ARG_LOC. */ if (spawn_argv[idx][0] == '-' && spawn_argv[idx][1] == '&') r = snprintf (p, MAX_ARG_STR, "-&" FMT_HD, (uintptr_t)hd); -- cgit