Commit a38f746f by Nicolas Capens

Avoid reading or writing the configuration file if we don't have access to it.…

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
parent 2f24de32
......@@ -35,6 +35,13 @@ namespace sw
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 @@ namespace sw
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;
......
#define MAJOR_VERSION 3
#define MINOR_VERSION 2
#define BUILD_VERSION 6
#define BUILD_REVISION 47297
#define BUILD_REVISION 47312
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment