From 1860f6407f834b681c21f67db7236eaad161524c Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Fri, 11 Oct 2024 16:17:53 +0900 Subject: spawn: Add new function to modify environment. * src/gpg-error.def.in (gpgrt_spawn_actions_set_envchange): New. * src/gpg-error.vers (gpgrt_spawn_actions_set_envchange): New. * src/gpg-error.h.in (gpgrt_spawn_actions_set_envchange): New. * src/gpgrt-int.h (_gpgrt_spawn_actions_set_envchange): New. * src/spawn-posix.c (struct gpgrt_spawn_actions): New field ENVCHANGE. (prepare_environ): New. (my_exec): Take care of ENVCHANGE. (_gpgrt_spawn_actions_set_envchange): New. * src/spawn-w32.c (struct gpgrt_spawn_actions): New field ENVCHANGE. (prepare_env_block): New. (_gpgrt_spawn_actions_set_envchange): New. (spawn_detached, _gpgrt_process_spawn): Take care of ENVCHANGE. * src/visibility.c (gpgrt_spawn_actions_set_envchange): New. * src/visibility.h (gpgrt_spawn_actions_set_envchange): New. * tests/Makefile.am (TESTS): Add t-spawn. * tests/t-spawn.c: New. -- GnuPG-bug-id: 7307 Signed-off-by: NIIBE Yutaka --- src/gpgrt-int.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gpgrt-int.h') diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h index 4a37686..55933a1 100644 --- a/src/gpgrt-int.h +++ b/src/gpgrt-int.h @@ -637,6 +637,8 @@ gpg_err_code_t _gpgrt_make_pipe (int filedes[2], estream_t *r_fp, /* Actions (at spawning a child process), which is OS-specific. */ gpg_err_code_t _gpgrt_spawn_actions_new (gpgrt_spawn_actions_t *r_act); void _gpgrt_spawn_actions_release (gpgrt_spawn_actions_t act); +void _gpgrt_spawn_actions_set_envchange (gpgrt_spawn_actions_t, + const char *const*); #ifdef HAVE_W32_SYSTEM void _gpgrt_spawn_actions_set_envvars (gpgrt_spawn_actions_t, char *); void _gpgrt_spawn_actions_set_redirect (gpgrt_spawn_actions_t, -- cgit v1.2.3