ServerInstance->Log(DEBUG,"Begin download for %s", file.c_str());
if ((file[0] == '/') || (file.substr(0, 7) == "file://"))
{
- ServerInstance->Log(DEBUG,"Core-handled schema for %s %s", file.c_str(), file.substr(0,7).c_str());
+ ServerInstance->Log(DEBUG,"Core-handled schema for %s", file.c_str());
/* For file:// schema files, we use std::ifstream which is a derivative of std::istream.
* For all other file schemas, we use a std::stringstream.
*/
x->second = conf;
}
else
+ {
+ delete x->second;
+ x->second = NULL;
FileErrors++;
+ }
TotalDownloaded++;
}
{
/* Modules handle these */
ServerInstance->Log(DEBUG,"Module-handled schema for %s", x->first.c_str());
+
+ /* For now, error it */
+ FileErrors++;
+ TotalDownloaded++;
+ delete x->second;
+ x->second = NULL;
}
}
}
}
else
{
- /* Check if the file open failed first */
- if (IncludedFiles.find(filename) == IncludedFiles.end())
+ std::map<std::string, std::istream*>::iterator x = IncludedFiles.find(filename);
+ if (x == IncludedFiles.end())
{
if (pass == 0)
{
}
}
else
- conf = IncludedFiles.find(filename)->second;
+ {
+ if (x->second)
+ conf = IncludedFiles.find(filename)->second;
+ else
+ {
+ errorstream << "File " << filename << " could not be opened." << std::endl;
+ return false;
+ }
+ }
}
/* Start reading characters... */
/* One or more file download/access errors, do not
* proceed to second pass
*/
+ for (std::map<std::string, std::istream*>::iterator x = Config->IncludedFiles.begin(); x != Config->IncludedFiles.end(); ++x)
+ {
+ if (!x->second)
+ printf("ERROR: Failed to access the file: %s.\n", x->first.c_str());
+ }
+ printf("Initialisation of configuration failed.\n");
Exit(EXIT_STATUS_CONFIG);
}