diff mbox series

support: Pass environ to child process

Message ID 20210316070234.329647-1-siddhesh@sourceware.org
State New
Headers show
Series support: Pass environ to child process | expand

Commit Message

Siddhesh Poyarekar March 16, 2021, 7:02 a.m. UTC
Pass environ to posix_spawn so that the child process can inherit
environment of the test.
---
 support/support_subprocess.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Florian Weimer March 16, 2021, 9:13 a.m. UTC | #1
* Siddhesh Poyarekar via Libc-alpha:

> Pass environ to posix_spawn so that the child process can inherit
> environment of the test.
> ---
>  support/support_subprocess.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/support/support_subprocess.c b/support/support_subprocess.c
> index 838eda96ff..2acfc57b7e 100644
> --- a/support/support_subprocess.c
> +++ b/support/support_subprocess.c
> @@ -84,7 +84,7 @@ support_subprogram (const char *file, char *const argv[])
>    xposix_spawn_file_actions_addclose (&fa, result.stdout_pipe[1]);
>    xposix_spawn_file_actions_addclose (&fa, result.stderr_pipe[1]);
>  
> -  result.pid = xposix_spawn (file, &fa, NULL, argv, NULL);
> +  result.pid = xposix_spawn (file, &fa, NULL, argv, environ);
>  
>    xclose (result.stdout_pipe[1]);
>    xclose (result.stderr_pipe[1]);

Seems reasonable.  Future callers could use clearenv to get the old
behavior if necessary.

Thanks,
Florian
diff mbox series

Patch

diff --git a/support/support_subprocess.c b/support/support_subprocess.c
index 838eda96ff..2acfc57b7e 100644
--- a/support/support_subprocess.c
+++ b/support/support_subprocess.c
@@ -84,7 +84,7 @@  support_subprogram (const char *file, char *const argv[])
   xposix_spawn_file_actions_addclose (&fa, result.stdout_pipe[1]);
   xposix_spawn_file_actions_addclose (&fa, result.stderr_pipe[1]);
 
-  result.pid = xposix_spawn (file, &fa, NULL, argv, NULL);
+  result.pid = xposix_spawn (file, &fa, NULL, argv, environ);
 
   xclose (result.stdout_pipe[1]);
   xclose (result.stderr_pipe[1]);