Skip to content

Commit

Permalink
HBSD: Fix OSX tests
Browse files Browse the repository at this point in the history
Provide further protection against test failures by providing an
abstraction for getting the environment variables.

Signed-off-by:	Shawn Webb <[email protected]>
  • Loading branch information
lattera committed Oct 8, 2024
1 parent c1cb32d commit 6eafb0b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion libarchive/filter_fork_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ extern char *const environ[];

#include "filter_fork.h"

static char * const *
__get_environment_ptr(void)
{
#if defined(HAVE_POSIX_SPAWNP) && defined(__FreeBSD__)
return environ;
#else
return NULL;
#endif
}

int
__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout,
pid_t *out_child)
Expand Down Expand Up @@ -141,7 +151,7 @@ __archive_create_child(const char *cmd, int *child_stdin, int *child_stdout,
goto actions_inited;
}
r = posix_spawnp(&child, cmdline->path, &actions, NULL,
cmdline->argv, environ);
cmdline->argv, __get_environment_ptr());
if (r != 0)
goto actions_inited;
posix_spawn_file_actions_destroy(&actions);
Expand Down

0 comments on commit 6eafb0b

Please sign in to comment.