[PATCH xorg-gtest 03/11] xserver: use temporary variable for log file too
Peter Hutterer
peter.hutterer at who-t.net
Wed Aug 15 23:36:36 PDT 2012
And use + for string concatination, the code as-is was a legacy from const
char* handling.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/xserver.cpp | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/xserver.cpp b/src/xserver.cpp
index 86c8484..eb64d3b 100644
--- a/src/xserver.cpp
+++ b/src/xserver.cpp
@@ -266,28 +266,27 @@ 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.";
+ message += "X.org server log file " + log + " is not writable.";
throw std::runtime_error(message);
}
- 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.";
+ message += "X.org old server log file " + old_log_file + " is not writable.";
throw std::runtime_error(message);
}
--
1.7.11.2
More information about the xorg-devel
mailing list