summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2022-06-24 18:21:17 (GMT)
committerRaul Tambre <raul@tambre.ee>2022-06-26 08:50:00 (GMT)
commit8eb8d16c194afec720d90f98aec46d63d5bbb33a (patch)
treedc3f4164e84635f359e69ab94108dbf2eb1c1ef8 /Source/cmSystemTools.cxx
parent324ca5b489076e548258fb7acd9ed3c238406eda (diff)
downloadCMake-8eb8d16c194afec720d90f98aec46d63d5bbb33a.zip
CMake-8eb8d16c194afec720d90f98aec46d63d5bbb33a.tar.gz
CMake-8eb8d16c194afec720d90f98aec46d63d5bbb33a.tar.bz2
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.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx3
1 files changed, 1 insertions, 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;