summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-09 23:39:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-09 23:39:16 +0000
commit5f56457576dbaedd8b8c228b245059bee3d8fcfc (patch)
treeebad2426ea9fd67f67ee0f03c143d5fdd0d65a90 /src
parent2e59ae625ecfe45b4d1d8bfb7cb7a6da701df9a3 (diff)
Check for nonexistent file
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6556 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules.cpp17
-rw-r--r--src/modules/m_httpd.cpp2
2 files changed, 13 insertions, 6 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index 211ce9853..2818de639 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -719,9 +719,11 @@ bool ConfigReader::Verify()
FileReader::FileReader(InspIRCd* Instance, const std::string &filename) : ServerInstance(Instance)
{
file_cache c;
- ServerInstance->Config->ReadFile(c,filename.c_str());
- this->fc = c;
- this->CalcSize();
+ if (!ServerInstance->Config->ReadFile(c,filename.c_str()))
+ {
+ this->fc = c;
+ this->CalcSize();
+ }
}
FileReader::FileReader(InspIRCd* Instance) : ServerInstance(Instance)
@@ -755,9 +757,12 @@ void FileReader::CalcSize()
void FileReader::LoadFile(const std::string &filename)
{
file_cache c;
- ServerInstance->Config->ReadFile(c,filename.c_str());
- this->fc = c;
- this->CalcSize();
+ c.clear();
+ if (ServerInstance->Config->ReadFile(c,filename.c_str()))
+ {
+ this->fc = c;
+ this->CalcSize();
+ }
}
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index b2ede6619..3342ba37d 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -371,6 +371,8 @@ class ModuleHttpServer : public Module
port = c.ReadInteger("http", "port", i, true);
indexfile = c.ReadValue("http", "index", i);
index = new FileReader(ServerInstance, indexfile);
+ if (!index->Exists())
+ throw ModuleException("Can't read index file: "+indexfile);
http = new HttpServerSocket(ServerInstance, bindip, port, true, 0, index);
httpsocks.push_back(http);
}