Skip to content

Commit 4085ff5

Browse files
committed
Replace putenv by setenv
1 parent 5b2404e commit 4085ff5

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

test/regression/regression.cc

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,9 @@ int main(int argc, char **argv) {
474474
ModSecurityTest<RegressionTest> test;
475475

476476
std::string ver(MODSECURITY_VERSION);
477-
std::string envvar("MODSECURITY=ModSecurity " + ver + " regression tests");
477+
std::string envvar("ModSecurity " + ver + " regression tests");
478478

479-
char *envvarptr = strdup(envvar.c_str());
480-
481-
putenv(envvarptr);
479+
setenv("MODSECURITY", envvar.c_str(), 1);
482480
#ifndef NO_LOGS
483481
int test_number = 0;
484482
#endif
@@ -538,9 +536,6 @@ int main(int argc, char **argv) {
538536

539537
if (test.m_count_all) {
540538
std::cout << std::to_string(keyList.size()) << std::endl;
541-
if (envvarptr != nullptr) {
542-
free(envvarptr);
543-
}
544539
exit(0);
545540
}
546541

@@ -611,9 +606,6 @@ int main(int argc, char **argv) {
611606
}
612607

613608
#endif
614-
if (envvarptr != nullptr) {
615-
free(envvarptr);
616-
}
617609

618610
return 0;
619611
}

0 commit comments

Comments
 (0)