aboutsummaryrefslogtreecommitdiffstats
path: root/common/exectool.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2024-07-09 00:39:15 +0000
committerNIIBE Yutaka <[email protected]>2024-07-09 01:04:16 +0000
commit953dd67368ceaeb8b42cfb8f9b5f3c4de8afdbe0 (patch)
tree34861697c585e95c970fd6955ea749867efcb6ec /common/exectool.c
parentspeedo: Set PREFIX for bzip2 build also for Unix. (diff)
downloadgnupg-953dd67368ceaeb8b42cfb8f9b5f3c4de8afdbe0.tar.gz
gnupg-953dd67368ceaeb8b42cfb8f9b5f3c4de8afdbe0.zip
Use gpgrt_process_spawn API from libgpg-error.
* agent/genkey.c (do_check_passphrase_pattern): Use the gpgrt API. * common/asshelp.c (start_new_service): Ditto. * common/exechelp.h: Remove gnupg_process_spawn API. * common/exechelp-posix.c: Remove gnupg_process_spawn implementation. * common/exechelp-w32.c: Likewise. * common/exectool.c (gnupg_exec_tool_stream): Use the gpgrt API. * common/t-exechelp.c (test_pipe_stream): Remove. * dirmngr/ldap-wrapper.c (destroy_wrapper, ldap_reaper_thread): Use the gpgrt API. (ldap_wrapper_connection_cleanup, ldap_wrapper): Ditto. * dirmngr/ldap.c, g10/call-keyboxd.c: No need to include exechelp.h. * g10/photoid.c (run_with_pipe, show_photo): Use the gpgrt API. * g13/be-encfs.c (run_umount_helper, run_encfs_tool): Ditto. * g13/g13.c, g13/mount.c, g13/runner.c: No need to include exechelp.h. * scd/apdu.c: No need to include exechelp.h. * scd/app.c (report_change): Use the gpgrt API. * sm/export.c, sm/import.c: No need to include exechelp.h. * tests/gpgscm/ffi.c (proc_object_finalize, proc_wrap) (do_process_spawn_io, do_process_spawn_fd, do_process_wait): Use the gpgrt API. * tools/gpg-auth.c: No need to include exechelp.h. * tools/gpg-card.c (cmd_gpg): Use the gpgrt API. * tools/gpg-connect-agent.c: No need to include exechelp.h. * tools/gpg-mail-tube.c (mail_tube_encrypt, prepare_for_appimage) (start_gpg_encrypt): Use the gpgrt API. * tools/gpgconf-comp.c (gpg_agent_runtime_change) (scdaemon_runtime_change, tpm2daemon_runtime_change) (dirmngr_runtime_change, keyboxd_runtime_change) (gc_component_launch, gc_component_check_options) (retrieve_options_from_program): Ditto. * tools/gpgconf.c (show_versions_via_dirmngr): Ditto. * tools/gpgtar-create.c (gpgtar_create): Ditto. * tools/gpgtar-extract.c (gpgtar_extract): Ditto. * tools/gpgtar-list.c (gpgtar_list): Ditto. -- GnuPG-bug-id: 7192 Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'common/exectool.c')
-rw-r--r--common/exectool.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/common/exectool.c b/common/exectool.c
index ce424fc49..bb867fbc3 100644
--- a/common/exectool.c
+++ b/common/exectool.c
@@ -43,11 +43,8 @@
#include "logging.h"
#include "membuf.h"
#include "mischelp.h"
-#ifdef HAVE_W32_SYSTEM
-#define NEED_STRUCT_SPAWN_CB_ARG 1
-#endif
-#include "exechelp.h"
#include "sysutils.h"
+#include "exechelp.h"
#include "util.h"
#include "exectool.h"
@@ -324,7 +321,7 @@ gnupg_exec_tool_stream (const char *pgmname, const char *argv[],
void *status_cb_value)
{
gpg_error_t err;
- gnupg_process_t proc = NULL;
+ gpgrt_process_t proc = NULL;
estream_t infp = NULL;
estream_t extrafp = NULL;
estream_t outfp = NULL, errfp = NULL;
@@ -342,7 +339,7 @@ gnupg_exec_tool_stream (const char *pgmname, const char *argv[],
read_and_log_buffer_t fderrstate;
struct copy_buffer *cpbuf_in = NULL, *cpbuf_out = NULL, *cpbuf_extra = NULL;
int quiet = 0;
- gnupg_spawn_actions_t act = NULL;
+ gpgrt_spawn_actions_t act = NULL;
int i = 0;
memset (fds, 0, sizeof fds);
@@ -433,22 +430,22 @@ gnupg_exec_tool_stream (const char *pgmname, const char *argv[],
exceptclose[i] = -1;
#endif
- err = gnupg_spawn_actions_new (&act);
+ err = gpgrt_spawn_actions_new (&act);
if (err)
goto leave;
#ifdef HAVE_W32_SYSTEM
- gnupg_spawn_actions_set_inherit_handles (act, exceptclose);
+ gpgrt_spawn_actions_set_inherit_handles (act, exceptclose);
#else
- gnupg_spawn_actions_set_inherit_fds (act, exceptclose);
+ gpgrt_spawn_actions_set_inherit_fds (act, exceptclose);
#endif
- err = gnupg_process_spawn (pgmname, argv,
+ err = gpgrt_process_spawn (pgmname, argv,
((input
- ? GNUPG_PROCESS_STDIN_PIPE
+ ? GPGRT_PROCESS_STDIN_PIPE
: 0)
- | GNUPG_PROCESS_STDOUT_PIPE
- | GNUPG_PROCESS_STDERR_PIPE), act, &proc);
- gnupg_process_get_streams (proc, GNUPG_PROCESS_STREAM_NONBLOCK,
+ | GPGRT_PROCESS_STDOUT_PIPE
+ | GPGRT_PROCESS_STDERR_PIPE), act, &proc);
+ gpgrt_process_get_streams (proc, GPGRT_PROCESS_STREAM_NONBLOCK,
input? &infp : NULL, &outfp, &errfp);
if (extrapipe[0] != -1)
close (extrapipe[0]);
@@ -581,26 +578,26 @@ gnupg_exec_tool_stream (const char *pgmname, const char *argv[],
es_fclose (outfp); outfp = NULL;
es_fclose (errfp); errfp = NULL;
- err = gnupg_process_wait (proc, 1);
+ err = gpgrt_process_wait (proc, 1);
if (!err)
{ /* To be compatible to old wait_process. */
int status;
- gnupg_process_ctl (proc, GNUPG_PROCESS_GET_EXIT_ID, &status);
+ gpgrt_process_ctl (proc, GPGRT_PROCESS_GET_EXIT_ID, &status);
if (status)
err = gpg_error (GPG_ERR_GENERAL);
}
leave:
if (err && proc)
- gnupg_process_terminate (proc);
+ gpgrt_process_terminate (proc);
es_fclose (infp);
es_fclose (extrafp);
es_fclose (outfp);
es_fclose (errfp);
- gnupg_process_release (proc);
- gnupg_spawn_actions_release (act);
+ gpgrt_process_release (proc);
+ gpgrt_spawn_actions_release (act);
copy_buffer_shred (cpbuf_in);
xfree (cpbuf_in);