diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2019-07-24 08:15:32 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2019-07-24 08:15:32 +0200 |
commit | b1c56cf9e2bb51abfd47747128bd2a6285ed1623 (patch) | |
tree | eda408025fcc5ef057272832473724a0596f2e54 | |
parent | common,w32: Fix cast from gnupg_fd_t to call _open_osfhandle. (diff) | |
download | gnupg2-b1c56cf9e2bb51abfd47747128bd2a6285ed1623.tar.xz gnupg2-b1c56cf9e2bb51abfd47747128bd2a6285ed1623.zip |
common: Use gnupg_spawn_process_fd to invoke gpg-agent/dirmngr.
* common/asshelp.c (start_new_gpg_agent): Call gnupg_spawn_process_fd
and gnupg_wait_process.
(start_new_dirmngr): Likewise.
--
With --daemon option, gpg-agent/dirmngr detaches by itself.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r-- | common/asshelp.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/common/asshelp.c b/common/asshelp.c index 5209ea6cf..600774330 100644 --- a/common/asshelp.c +++ b/common/asshelp.c @@ -492,8 +492,13 @@ start_new_gpg_agent (assuan_context_t *r_ctx, if (!(err = lock_spawning (&lock, gnupg_homedir (), "agent", verbose)) && assuan_socket_connect (ctx, sockname, 0, 0)) { - err = gnupg_spawn_process_detached (program? program : agent_program, - argv, NULL); + pid_t pid; + + err = gnupg_spawn_process_fd (program? program : agent_program, + argv, -1, -1, -1, &pid); + if (!err) + err = gnupg_wait_process (program? program : agent_program, + pid, 1, NULL); if (err) log_error ("failed to start agent '%s': %s\n", agent_program, gpg_strerror (err)); @@ -627,7 +632,12 @@ start_new_dirmngr (assuan_context_t *r_ctx, if (!(err = lock_spawning (&lock, gnupg_homedir (), "dirmngr", verbose)) && assuan_socket_connect (ctx, sockname, 0, 0)) { - err = gnupg_spawn_process_detached (dirmngr_program, argv, NULL); + pid_t pid; + + err = gnupg_spawn_process_fd (dirmngr_program, argv, + -1, -1, -1, &pid); + if (!err) + err = gnupg_wait_process (dirmngr_program, pid, 1, NULL); if (err) log_error ("failed to start the dirmngr '%s': %s\n", dirmngr_program, gpg_strerror (err)); |