mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +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:
parent
b9a40cdc18
commit
df225a87b9
2 changed files with 7 additions and 1 deletions
|
@ -516,6 +516,7 @@ AC_CHECK_HEADERS([crt_externs.h])
|
|||
# sendfile - non-POSIX, found in glibc
|
||||
# pipe2 - non-POSIX, found in glibc (GNU/Linux and GNU/Hurd)
|
||||
# posix_spawn_file_actions_addclosefrom_np - glibc >= 2.34
|
||||
#...clearenv - non-POSIX, found in glibc
|
||||
#
|
||||
AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid \
|
||||
fesetround ftime ftruncate fchown fchownat fchmod fchdir readlinkat \
|
||||
|
@ -530,7 +531,8 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid \
|
|||
strcoll_l strtod_l strtol_l newlocale uselocale utimensat \
|
||||
fstatat futimens openat \
|
||||
sched_getaffinity sched_setaffinity sendfile pipe2 \
|
||||
posix_spawn_file_actions_addclosefrom_np])
|
||||
posix_spawn_file_actions_addclosefrom_np \
|
||||
clearenv])
|
||||
|
||||
# The newlib C library uses _NL_ prefixed locale langinfo constants.
|
||||
AC_CHECK_DECLS([_NL_NUMERIC_GROUPING], [], [], [[#include <langinfo.h>]])
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue