From: Christian Goeschel Ndjomouo Date: Mon, 30 Mar 2026 13:10:52 +0000 (-0400) Subject: nsenter: use clearenv() only when it is available X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=088c29ec6a64713bd3cb5d493776e8659ebd6479;p=thirdparty%2Futil-linux.git nsenter: use clearenv() only when it is available Signed-off-by: Christian Goeschel Ndjomouo --- diff --git a/sys-utils/nsenter.c b/sys-utils/nsenter.c index e10ba9cf9..245e1673e 100644 --- a/sys-utils/nsenter.c +++ b/sys-utils/nsenter.c @@ -37,6 +37,10 @@ # include #endif +#ifndef HAVE_ENVIRON_DECL +extern char **environ; +#endif + #include "strutils.h" #include "nls.h" #include "c.h" @@ -912,7 +916,11 @@ int main(int argc, char *argv[]) ls = env_list_from_fd(env_fd); if (!ls && errno) err(EXIT_FAILURE, _("failed to get environment variables")); +#ifdef HAVE_CLEARENV clearenv(); +#else + environ = NULL; +#endif if (ls && env_list_setenv(ls, 0) < 0) err(EXIT_FAILURE, _("failed to set environment variables")); env_list_free(ls);