From 5e834968b21847381a95992df1816d75429cf5c4 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 15 Nov 2014 13:27:28 +0100 Subject: [PATCH] Handle ENCFS6_CONFIG set to non-existing file This used to give the confusing error Found config file %s, but failed to load - exiting --- encfs/FileUtils.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/encfs/FileUtils.cpp b/encfs/FileUtils.cpp index ef9c85e..c3538e0 100644 --- a/encfs/FileUtils.cpp +++ b/encfs/FileUtils.cpp @@ -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;