From 8eb8d16c194afec720d90f98aec46d63d5bbb33a Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Fri, 24 Jun 2022 21:21:17 +0300 Subject: cmSystemTools: Fix unsetenv() fallback The fallback path boils down to putenv(). Calling that with a "=" sets the variable to an empty string. Use cmSystemTools::UnPutEnv() instead, which correctly handles unsetting variables on a variety of systems. --- Source/cmSystemTools.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 55b0df8..3de45bc 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1501,8 +1501,7 @@ std::string cmSystemTools::RelativeIfUnder(std::string const& top, bool cmSystemTools::UnsetEnv(const char* value) { # if !defined(HAVE_UNSETENV) - std::string var = cmStrCat(value, '='); - return cmSystemTools::PutEnv(var); + return cmSystemTools::UnPutEnv(value); # else unsetenv(value); return true; -- cgit v0.12