1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 09:10:22 +02:00

Test for clearenv function

clearenv() may not be provided by non-glibc systems.  As a fallback,
just set environ to NULL.

* libguile/posix.c (scm_environ)[!HAVE_CLEARENV]: add fallback logic
    for clearenv()
This commit is contained in:
Michael Gran 2023-07-17 16:07:37 -07:00
parent b9a40cdc18
commit df225a87b9
2 changed files with 7 additions and 1 deletions

View file

@ -1773,7 +1773,11 @@ SCM_DEFINE (scm_environ, "environ", 0, 1, 0,
{
/* Arrange to not use GC-allocated storage for what goes into
'environ' as libc might reallocate it behind our back. */
#if HAVE_CLEARENV
clearenv ();
#else
environ = NULL;
#endif
while (!scm_is_null (env))
{
scm_putenv (scm_car (env));