diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-08-16 16:11:00 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-08-17 10:18:09 +1000 |
commit | 984b40872e58a3d8f4781ad00f649a3259b8afde (patch) | |
tree | 4c248922d153bcac6c751a61f791be64b66dd8ce | |
parent | ae9534590ce81ac78f90eb74152c3145200468e5 (diff) |
xserver: use temporary variable for log file too
And use + for string concatination, the code as-is was a legacy from const
char* handling.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r-- | src/xserver.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/xserver.cpp b/src/xserver.cpp index 86c8484..4ea85d6 100644 --- a/src/xserver.cpp +++ b/src/xserver.cpp @@ -266,31 +266,24 @@ void xorg::testing::XServer::TestStartup(void) { throw std::runtime_error(message); } + std::string log = d_->options["-logfile"]; + /* The Xorg server won't start unless the log file and the old log file are * writable. */ std::ofstream log_test; - log_test.open(d_->options["-logfile"].c_str(), std::ofstream::out); + log_test.open(log.c_str(), std::ofstream::out); log_test.close(); if (log_test.fail()) { - std::string message; - message += "X.org server log file "; - message += d_->options["-logfile"]; - message += " is not writable."; - throw std::runtime_error(message); + throw std::runtime_error("X.org server log file " + log + " is not writable."); } - std::string old_log_file = d_->options["-logfile"]; - old_log_file += ".old"; + std::string old_log_file = log + ".old"; + log_test.open(old_log_file.c_str(), std::ofstream::out); log_test.close(); if (log_test.fail()) { - std::string message; - message += "X.org old server log file "; - message += old_log_file; - message += " is not writable."; - throw std::runtime_error(message); + throw std::runtime_error("X.org old server log file " + old_log_file + " is not writable."); } - } const std::string& xorg::testing::XServer::GetVersion(void) { |