Replace putenv by setenv

This commit is contained in:
Ervin Hegedus 2024-03-27 13:14:11 +01:00
parent 5b2404e44d
commit 4085ff5536
No known key found for this signature in database
GPG Key ID: 5FA5BC3F5EC41F61

View File

@ -474,11 +474,9 @@ int main(int argc, char **argv) {
ModSecurityTest<RegressionTest> test;
std::string ver(MODSECURITY_VERSION);
std::string envvar("MODSECURITY=ModSecurity " + ver + " regression tests");
std::string envvar("ModSecurity " + ver + " regression tests");
char *envvarptr = strdup(envvar.c_str());
putenv(envvarptr);
setenv("MODSECURITY", envvar.c_str(), 1);
#ifndef NO_LOGS
int test_number = 0;
#endif
@ -538,9 +536,6 @@ int main(int argc, char **argv) {
if (test.m_count_all) {
std::cout << std::to_string(keyList.size()) << std::endl;
if (envvarptr != nullptr) {
free(envvarptr);
}
exit(0);
}
@ -611,9 +606,6 @@ int main(int argc, char **argv) {
}
#endif
if (envvarptr != nullptr) {
free(envvarptr);
}
return 0;
}