1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

common: Fix the previous commit.

* common/asshelp.c [HAVE_W32_SYSTEM] (start_new_gpg_agent): Use
gnupg_spawn_process_detached.
(start_new_dirmngr): Likewise.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2019-07-24 15:32:13 +09:00
parent b1c56cf9e2
commit 044379772f

View File

@ -492,6 +492,10 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
if (!(err = lock_spawning (&lock, gnupg_homedir (), "agent", verbose)) if (!(err = lock_spawning (&lock, gnupg_homedir (), "agent", verbose))
&& assuan_socket_connect (ctx, sockname, 0, 0)) && assuan_socket_connect (ctx, sockname, 0, 0))
{ {
#ifdef HAVE_W32_SYSTEM
err = gnupg_spawn_process_detached (program? program : agent_program,
argv, NULL);
#else
pid_t pid; pid_t pid;
err = gnupg_spawn_process_fd (program? program : agent_program, err = gnupg_spawn_process_fd (program? program : agent_program,
@ -499,6 +503,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
if (!err) if (!err)
err = gnupg_wait_process (program? program : agent_program, err = gnupg_wait_process (program? program : agent_program,
pid, 1, NULL); pid, 1, NULL);
#endif
if (err) if (err)
log_error ("failed to start agent '%s': %s\n", log_error ("failed to start agent '%s': %s\n",
agent_program, gpg_strerror (err)); agent_program, gpg_strerror (err));
@ -632,12 +637,16 @@ start_new_dirmngr (assuan_context_t *r_ctx,
if (!(err = lock_spawning (&lock, gnupg_homedir (), "dirmngr", verbose)) if (!(err = lock_spawning (&lock, gnupg_homedir (), "dirmngr", verbose))
&& assuan_socket_connect (ctx, sockname, 0, 0)) && assuan_socket_connect (ctx, sockname, 0, 0))
{ {
#ifdef HAVE_W32_SYSTEM
err = gnupg_spawn_process_detached (dirmngr_program, argv, NULL);
#else
pid_t pid; pid_t pid;
err = gnupg_spawn_process_fd (dirmngr_program, argv, err = gnupg_spawn_process_fd (dirmngr_program, argv,
-1, -1, -1, &pid); -1, -1, -1, &pid);
if (!err) if (!err)
err = gnupg_wait_process (dirmngr_program, pid, 1, NULL); err = gnupg_wait_process (dirmngr_program, pid, 1, NULL);
#endif
if (err) if (err)
log_error ("failed to start the dirmngr '%s': %s\n", log_error ("failed to start the dirmngr '%s': %s\n",
dirmngr_program, gpg_strerror (err)); dirmngr_program, gpg_strerror (err));