diff options
author | NIIBE Yutaka <[email protected]> | 2024-05-30 05:12:37 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2024-05-30 05:12:37 +0000 |
commit | adcb4170a40d7cf66181a6b3efc7c187892a1318 (patch) | |
tree | c6489d6e47af5574874cfff47657a04ea3c2936b | |
parent | Fix process termination check at release. (diff) | |
download | libgpg-error-adcb4170a40d7cf66181a6b3efc7c187892a1318.tar.gz libgpg-error-adcb4170a40d7cf66181a6b3efc7c187892a1318.zip |
spawn: Allow NULL for ACT.
* src/spawn-posix.c (_gpgrt_process_spawn): ACT may be null.
* src/spawn-w32.c (_gpgrt_process_spawn): Likewise.
--
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r-- | src/spawn-posix.c | 12 | ||||
-rw-r--r-- | src/spawn-w32.c | 9 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/spawn-posix.c b/src/spawn-posix.c index 2faa299..eb990ad 100644 --- a/src/spawn-posix.c +++ b/src/spawn-posix.c @@ -296,8 +296,7 @@ struct gpgrt_spawn_actions { }; static void -my_exec (const char *pgmname, const char *argv[], - gpgrt_spawn_actions_t act) +my_exec (const char *pgmname, const char *argv[], gpgrt_spawn_actions_t act) { int i; @@ -482,6 +481,15 @@ _gpgrt_process_spawn (const char *pgmname, const char *argv1[], pid_t pid; const char **argv; int i, j; + struct gpgrt_spawn_actions act_default; + + if (!act) + { + memset (&act_default, 0, sizeof (act_default)); + for (i = 0; i <= 2; i++) + act_default.fd[i] = -1; + act = &act_default; + } if (r_process) *r_process = NULL; diff --git a/src/spawn-w32.c b/src/spawn-w32.c index 4d41c21..139a71f 100644 --- a/src/spawn-w32.c +++ b/src/spawn-w32.c @@ -560,6 +560,15 @@ _gpgrt_process_spawn (const char *pgmname, const char *argv[], int i; BOOL ask_inherit = FALSE; BOOL allow_foreground_window = FALSE; + struct gpgrt_spawn_actions act_default; + + if (!act) + { + memset (&act_default, 0, sizeof (act_default)); + for (i = 0; i <= 2; i++) + act_default.hd[i] = INVALID_HANDLE_VALUE; + act = &act_default; + } /* Build the command line. */ ec = build_w32_commandline (pgmname, argv, &cmdline); |