diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2024-07-09 02:39:15 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2024-07-09 03:04:16 +0200 |
commit | 953dd67368ceaeb8b42cfb8f9b5f3c4de8afdbe0 (patch) | |
tree | 34861697c585e95c970fd6955ea749867efcb6ec /tools/gpg-mail-tube.c | |
parent | speedo: Set PREFIX for bzip2 build also for Unix. (diff) | |
download | gnupg2-953dd67368ceaeb8b42cfb8f9b5f3c4de8afdbe0.tar.xz gnupg2-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 <gniibe@fsij.org>
Diffstat (limited to 'tools/gpg-mail-tube.c')
-rw-r--r-- | tools/gpg-mail-tube.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/tools/gpg-mail-tube.c b/tools/gpg-mail-tube.c index d039bf120..e7ca57c1c 100644 --- a/tools/gpg-mail-tube.c +++ b/tools/gpg-mail-tube.c @@ -35,7 +35,6 @@ #include "../common/init.h" #include "../common/sysutils.h" #include "../common/ccparray.h" -#include "../common/exechelp.h" #include "../common/mbox-util.h" #include "../common/zb32.h" #include "rfc822parse.h" @@ -151,7 +150,7 @@ struct parser_context_s static gpg_error_t mail_tube_encrypt (estream_t fpin, strlist_t recipients); static void prepare_for_appimage (void); static gpg_error_t start_gpg_encrypt (estream_t *r_input, - gnupg_process_t *r_proc, + gpgrt_process_t *r_proc, strlist_t recipients); @@ -405,7 +404,7 @@ mail_tube_encrypt (estream_t fpin, strlist_t recipients) const char *s; char *boundary = NULL; /* Actually only the random part of it. */ estream_t gpginfp = NULL; - gnupg_process_t proc = NULL; + gpgrt_process_t proc = NULL; int exitcode; int i, found; @@ -562,14 +561,14 @@ mail_tube_encrypt (estream_t fpin, strlist_t recipients) if (err) log_error ("error closing pipe: %s\n", gpg_strerror (err)); - err = gnupg_process_wait (proc, 1 /* hang */); + err = gpgrt_process_wait (proc, 1 /* hang */); if (err) { log_error ("waiting for process %s failed: %s\n", opt.gpg_program, gpg_strerror (err)); goto leave; } - gnupg_process_ctl (proc, GNUPG_PROCESS_GET_EXIT_ID, &exitcode); + gpgrt_process_ctl (proc, GPGRT_PROCESS_GET_EXIT_ID, &exitcode); if (exitcode) { log_error ("running %s failed: exitcode=%d\n", @@ -577,7 +576,7 @@ mail_tube_encrypt (estream_t fpin, strlist_t recipients) goto leave; } - gnupg_process_release (proc); + gpgrt_process_release (proc); proc = NULL; /* Output the final boundary. */ @@ -597,7 +596,7 @@ mail_tube_encrypt (estream_t fpin, strlist_t recipients) leave: gpgrt_fcancel (gpginfp); - gnupg_process_release (proc); + gpgrt_process_release (proc); rfc822parse_cancel (ctx->msg); xfree (boundary); return err; @@ -688,16 +687,16 @@ prepare_for_appimage (void) { /* Run the sleep program for 2^30 seconds (34 years). */ static const char *args[4] = { "-c", "sleep", "1073741824", NULL }; - gnupg_spawn_actions_t act; + gpgrt_spawn_actions_t act; fname = make_filename ("~/.gnupg-vsd/gnupg-vs-desktop.AppImage", NULL); - err = gnupg_spawn_actions_new (&act); + err = gpgrt_spawn_actions_new (&act); if (!err) { - err = gnupg_process_spawn (fname, args, - GNUPG_PROCESS_DETACHED, act, NULL); - gnupg_spawn_actions_release (act); + err = gpgrt_process_spawn (fname, args, + GPGRT_PROCESS_DETACHED, act, NULL); + gpgrt_spawn_actions_release (act); } if (err) { @@ -730,7 +729,7 @@ prepare_for_appimage (void) * is stored at R_INPUT and the process objectat R_PROC. The gpg * output is sent to stdout and is always armored. */ static gpg_error_t -start_gpg_encrypt (estream_t *r_input, gnupg_process_t *r_proc, +start_gpg_encrypt (estream_t *r_input, gpgrt_process_t *r_proc, strlist_t recipients) { gpg_error_t err; @@ -742,7 +741,7 @@ start_gpg_encrypt (estream_t *r_input, gnupg_process_t *r_proc, int except[2] = { -1, -1 }; #endif const char **argv; - gnupg_spawn_actions_t act = NULL; + gpgrt_spawn_actions_t act = NULL; char *logfilebuf = NULL; *r_input = NULL; @@ -786,7 +785,7 @@ start_gpg_encrypt (estream_t *r_input, gnupg_process_t *r_proc, goto leave; } - err = gnupg_spawn_actions_new (&act); + err = gpgrt_spawn_actions_new (&act); if (err) { xfree (argv); @@ -794,24 +793,24 @@ start_gpg_encrypt (estream_t *r_input, gnupg_process_t *r_proc, } #ifdef HAVE_W32_SYSTEM - gnupg_spawn_actions_set_inherit_handles (act, except); + gpgrt_spawn_actions_set_inherit_handles (act, except); #else - gnupg_spawn_actions_set_inherit_fds (act, except); + gpgrt_spawn_actions_set_inherit_fds (act, except); #endif - err = gnupg_process_spawn (opt.gpg_program, argv, - (GNUPG_PROCESS_STDIN_PIPE - | GNUPG_PROCESS_STDOUT_KEEP - | GNUPG_PROCESS_STDERR_KEEP), act, r_proc); - gnupg_spawn_actions_release (act); + err = gpgrt_process_spawn (opt.gpg_program, argv, + (GPGRT_PROCESS_STDIN_PIPE + | GPGRT_PROCESS_STDOUT_KEEP + | GPGRT_PROCESS_STDERR_KEEP), act, r_proc); + gpgrt_spawn_actions_release (act); xfree (argv); if (err) goto leave; - gnupg_process_get_streams (*r_proc, 0, r_input, NULL, NULL); + gpgrt_process_get_streams (*r_proc, 0, r_input, NULL, NULL); leave: if (err) { - gnupg_process_release (*r_proc); + gpgrt_process_release (*r_proc); *r_proc = NULL; } xfree (logfilebuf); |