From 587b022b0ad40758233c31a3ec9b140f075c3e61 Mon Sep 17 00:00:00 2001 From: Janos Farkas Date: Tue, 2 Apr 2019 16:39:21 +0000 Subject: common: avoid std::ofstream copy Using a copy constructor to set the logfile is the only thing that stops compilation with the libstdc++ shipping with gcc 4.8 (maybe 4.7) --- common/command.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/command.cc b/common/command.cc index 6f4137fe..49081e72 100644 --- a/common/command.cc +++ b/common/command.cc @@ -87,8 +87,8 @@ bool CommandHandler::executeBeforeContext() if (vm.count("log")) { std::string logfilename = vm["log"].as(); - 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)); } -- cgit v1.2.3