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