Avoid reading or writing the configuration file if we don't have access to it. In particular this helps prevent the seccomp-bpf sandbox from shutting things down. crbug.com/336438
diff --git a/src/Common/Configurator.cpp b/src/Common/Configurator.cpp index 2956bf8..94fbe68 100644 --- a/src/Common/Configurator.cpp +++ b/src/Common/Configurator.cpp
@@ -35,6 +35,13 @@ bool Configurator::readFile() { + #if defined(__unix__) + if(access(path.c_str(), R_OK) != 0) + { + return false; + } + #endif + fstream file(path.c_str(), ios::in); if(file.fail()) return false; @@ -102,6 +109,13 @@ void Configurator::writeFile(std::string title) { + #if defined(__unix__) + if(access(path.c_str(), W_OK) != 0) + { + return; + } + #endif + fstream file(path.c_str(), ios::out); if(file.fail()) return;