Skip to content

Commit

Permalink
Replace putenv by setenv
Browse files Browse the repository at this point in the history
  • Loading branch information
airween committed Mar 27, 2024
1 parent 5b2404e commit 4085ff5
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions test/regression/regression.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -611,9 +606,6 @@ int main(int argc, char **argv) {
}

#endif
if (envvarptr != nullptr) {
free(envvarptr);
}

return 0;
}

0 comments on commit 4085ff5

Please sign in to comment.