Merge pull request #262 from chexum/gcc4x

common: avoid std::ofstream copy
This commit is contained in:
Eddie Hung 2019-04-02 11:57:55 -07:00 committed by GitHub
commit 6adf37e3c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,8 +87,8 @@ bool CommandHandler::executeBeforeContext()
if (vm.count("log")) {
std::string logfilename = vm["log"].as<std::string>();
logfile = std::ofstream(logfilename);
if (!logfile)
logfile.open(logfilename);
if (!logfile.is_open())
log_error("Failed to open log file '%s' for writing.\n", logfilename.c_str());
log_streams.push_back(std::make_pair(&logfile, LogLevel::LOG_MSG));
}