On Fri, May 25, 2012 at 08:22:11AM -0700, Chase Douglas wrote: > Otherwise, the server will fail to start and it won't be obvious what > happened. > > Signed-off-by: Chase Douglas <[email protected]> > --- > src/environment.cpp | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/src/environment.cpp b/src/environment.cpp > index 68e05ce..a3a8ead 100644 > --- a/src/environment.cpp > +++ b/src/environment.cpp > @@ -36,6 +36,7 @@ > #include <csignal> > #include <cstdlib> > #include <cstring> > +#include <fstream> > #include <iostream> > #include <stdexcept> > > @@ -114,6 +115,31 @@ void xorg::testing::Environment::SetUp() { > throw std::runtime_error(message); > } > > + /* 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_->path_to_log_file.c_str(), std::ofstream::out); > + log_test.close(); > + if (log_test.fail()) { > + std::string message; > + message += "X.org server log file "; > + message += d_->path_to_log_file; > + message += " is not writable."; > + throw std::runtime_error(message); > + } > + > + std::string old_log_file = d_->path_to_log_file.c_str(); > + old_log_file += ".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); > + } > +
access(2) may be simpler? Reviewed-by: Peter Hutterer <[email protected]> anyhow though, it does the job Cheers, Peter > d_->process.Start(d_->path_to_server, d_->path_to_server.c_str(), > display_string, > "-logfile", d_->path_to_log_file.c_str(), > -- > 1.7.9.5 > _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
