Prevent against environment modifications

Should not be necessary here, but better safe than sorry.
This commit is contained in:
Robbert van der Helm
2021-06-16 01:11:36 +02:00
parent efeb8d7348
commit 4d58adb83f
+4 -2
View File
@@ -25,6 +25,8 @@
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
namespace bp = boost::process;
/** /**
* The environment variable indicating whether to log to a file. Will log to * The environment variable indicating whether to log to a file. Will log to
* STDERR if not specified. * STDERR if not specified.
@@ -49,7 +51,7 @@ Logger::Logger(std::shared_ptr<std::ostream> stream,
prefix_timestamp(prefix_timestamp) {} prefix_timestamp(prefix_timestamp) {}
Logger Logger::create_from_environment(std::string prefix) { Logger Logger::create_from_environment(std::string prefix) {
auto env = boost::this_process::environment(); bp::environment env = boost::this_process::environment();
std::string file_path = env[logging_file_environment_variable].to_string(); std::string file_path = env[logging_file_environment_variable].to_string();
std::string verbosity = std::string verbosity =
env[logging_verbosity_environment_variable].to_string(); env[logging_verbosity_environment_variable].to_string();
@@ -81,7 +83,7 @@ Logger Logger::create_from_environment(std::string prefix) {
} }
Logger Logger::create_wine_stderr() { Logger Logger::create_wine_stderr() {
auto env = boost::this_process::environment(); bp::environment env = boost::this_process::environment();
std::string verbosity = std::string verbosity =
env[logging_verbosity_environment_variable].to_string(); env[logging_verbosity_environment_variable].to_string();