aboutsummaryrefslogtreecommitdiffstats
path: root/common/exechelp-posix.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2022-11-28 00:43:24 +0000
committerNIIBE Yutaka <[email protected]>2022-11-28 00:43:24 +0000
commit60b6cfe71f15e68c8c21daf5da9f4609318e2500 (patch)
tree316a088251faaf4117b8dbd13131aa4e6181e6f0 /common/exechelp-posix.c
parentChange spawn_cb semantics. (diff)
downloadgnupg-60b6cfe71f15e68c8c21daf5da9f4609318e2500.tar.gz
gnupg-60b6cfe71f15e68c8c21daf5da9f4609318e2500.zip
posix: Fix for spawn_cb.
-- Fixes: 7571fd4cd02571ddd0ba84700c0a52704f0a9b5c Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'common/exechelp-posix.c')
-rw-r--r--common/exechelp-posix.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/common/exechelp-posix.c b/common/exechelp-posix.c
index a3237020e..f44256703 100644
--- a/common/exechelp-posix.c
+++ b/common/exechelp-posix.c
@@ -1000,11 +1000,12 @@ my_exec (const char *pgmname, const char *argv[],
sca.fds[0] = fd_in;
sca.fds[1] = fd_out;
sca.fds[2] = fd_err;
+ sca.except_fds = NULL;
sca.arg = spawn_cb_arg;
/* Assign /dev/null to unused FDs. */
for (i = 0; i <= 2; i++)
- if (fds[i] == -1)
+ if (sca.fds[i] == -1)
sca.fds[i] = posix_open_null (i);
if (spawn_cb)
@@ -1022,7 +1023,7 @@ my_exec (const char *pgmname, const char *argv[],
/* Close all other files. */
if (!ask_inherit)
- close_all_fds (3, NULL);
+ close_all_fds (3, sca.except_fds);
execv (pgmname, (char *const *)argv);
/* No way to print anything, as we have may have closed all streams. */
@@ -1106,7 +1107,8 @@ spawn_detached (gnupg_process_t process,
gpg_err_code_t
gnupg_process_spawn (const char *pgmname, const char *argv1[],
unsigned int flags,
- int (*spawn_cb) (void *), void *spawn_cb_arg,
+ int (*spawn_cb) (struct spawn_cb_arg *),
+ void *spawn_cb_arg,
gnupg_process_t *r_process)
{
gpg_err_code_t ec;