From fdec8e9d07ff614834c0f39ddd04513cc5648b9a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 16 Oct 2020 07:28:07 -0700 Subject: sysif: respect HAVE_SETENV. * sysif.c (setenv_wrap, unsetenv_wrap): Now surrounded with #if HAVE_SETENV ... #endif, an existing feature detection macro. (sysif_init): Only register setenv and unsetenv functions if HAVE_SETENV is true. --- sysif.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sysif.c') diff --git a/sysif.c b/sysif.c index 6bf69715..45bbde17 100644 --- a/sysif.c +++ b/sysif.c @@ -1398,6 +1398,8 @@ val getenv_wrap(val name) return result; } +#if HAVE_SETENV + static val setenv_wrap(val name, val value, val overwrite) { val self = lit("setenv"); @@ -1442,6 +1444,8 @@ static val unsetenv_wrap(val name) return name; } +#endif + #if HAVE_POLL static val poll_wrap(val poll_list, val timeout_in) @@ -2861,8 +2865,10 @@ void sysif_init(void) reg_fun(intern(lit("pipe"), user_package), func_n0(pipe_wrap)); #endif reg_fun(intern(lit("getenv"), user_package), func_n1(getenv_wrap)); +#if HAVE_SETENV reg_fun(intern(lit("setenv"), user_package), func_n3o(setenv_wrap, 2)); reg_fun(intern(lit("unsetenv"), user_package), func_n1(unsetenv_wrap)); +#endif #if HAVE_GETEUID reg_fun(intern(lit("getuid"), user_package), func_n0(getuid_wrap)); -- cgit v1.2.3