Using setenv instead of putenv on SetEnv action

This commit is contained in:
Felipe Zimmerle
2020-12-09 18:39:24 -03:00
parent 03b3e472d4
commit f1f2527c03
3 changed files with 40 additions and 7 deletions

View File

@@ -34,10 +34,10 @@ bool SetENV::init(std::string *error) {
bool SetENV::evaluate(RuleWithActions *rule, Transaction *t) {
std::string colNameExpanded(m_string->evaluate(t));
auto pair = utils::string::ssplit_pair(colNameExpanded, '=');
ms_dbg_a(t, 8, "Setting envoriment variable: "
+ colNameExpanded + ".");
putenv(strdup(colNameExpanded.c_str()));
+ pair.first + " to " + pair.second);
setenv(pair.first.c_str(), pair.second.c_str(), /*overwrite*/ 1);
return true;
}