[client] config: print error when app:configFile is not a valid file

This makes it clear to the user that app:configFile is at fault.
This commit is contained in:
Quantum 2021-07-30 07:24:55 -04:00 committed by Geoffrey McRae
parent 64c906b801
commit b8b70e772e

View File

@ -503,6 +503,12 @@ bool config_load(int argc, char * argv[])
const char * configFile = option_get_string("app", "configFile"); const char * configFile = option_get_string("app", "configFile");
if (configFile) if (configFile)
{ {
if (stat(configFile, &st) < 0 || !S_ISREG(st.st_mode))
{
DEBUG_ERROR("app:configFile set to invalid file: %s", configFile);
return false;
}
DEBUG_INFO("Loading config from: %s", configFile); DEBUG_INFO("Loading config from: %s", configFile);
if (!option_load(configFile)) if (!option_load(configFile))
return false; return false;