Handle ENCFS6_CONFIG set to non-existing file

This used to give the confusing error

	Found config file %s, but failed to load - exiting
This commit is contained in:
Jakob Unterwurzacher 2014-11-15 13:27:28 +01:00
parent b2943eeed1
commit 5e834968b2

View File

@ -363,7 +363,13 @@ ConfigType readConfig(const string &rootDir,
// allow environment variable to override default config path
if (nm->environmentOverride != NULL) {
char *envFile = getenv(nm->environmentOverride);
if (envFile != NULL) return readConfig_load(nm, envFile, config);
if (envFile != NULL) {
if (! fileExists(envFile)) {
rError("fatal: config file specified by environment does not exist: %s", envFile);
exit(1);
}
return readConfig_load(nm, envFile, config);
}
}
// the standard place to look is in the root directory
string path = rootDir + nm->fileName;