summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-27 14:31:58 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-27 14:31:58 +0000
commit8adb22f193181b511a9b9f3d711618bdd20bbdb2 (patch)
treeb25c0b34c86130a6e3df8b6cce3f58f52f053c9d
parentf422c0c74d6f5ece818c9ceddb6ee340b643f32a (diff)
Fix for bug in windows with backslash directory seperators in config path when used with <include> tag and a relative include path, reported by daurnimator
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8386 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/configreader.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index ed1216c8b..d14fc92a8 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -1391,15 +1391,10 @@ bool ServerConfig::DoInclude(ConfigDataHash &target, const std::string &file, st
confpath = ServerInstance->ConfigFileName;
newfile = file;
- for (std::string::iterator c = newfile.begin(); c != newfile.end(); c++)
- {
- if (*c == '\\')
- {
- *c = '/';
- }
- }
+ std::replace(newfile.begin(),newfile.end(),'\\','/');
+ std::replace(confpath.begin(),confpath.end(),'\\','/');
- if (file[0] != '/')
+ if (newfile[0] != '/')
{
if((pos = confpath.rfind("/")) != std::string::npos)
{
@@ -1408,7 +1403,7 @@ bool ServerConfig::DoInclude(ConfigDataHash &target, const std::string &file, st
}
else
{
- errorstream << "Couldn't get config path from: " << confpath << std::endl;
+ errorstream << "Couldn't get config path from: " << ServerInstance->ConfigFileName << std::endl;
return false;
}
}