diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-05-12 16:00:34 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-05-12 16:00:34 +0000 |
commit | 46f43132aadf89cbb362803335018bd96e0ab4dc (patch) | |
tree | 76d0098be0379be4311ee640208e124c2989356b | |
parent | 03fe9de7ac49af62e95b6dd3341b2012c9a530cf (diff) |
Patch ReadFile() not to bork on one line files, and ensure it works ok with win32 (it does)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9707 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/configreader.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index 2ee6ace26..5b582b713 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -1889,11 +1889,13 @@ bool ServerConfig::ReadFile(file_cache &F, const char* fname) std::string confpath = ServerInstance->ConfigFileName; std::string newfile = fname; - if ((pos = confpath.rfind("/")) != std::string::npos) + if (((pos = confpath.rfind("/"))) != std::string::npos) newfile = confpath.substr(0, pos) + std::string("/") + fname; - else if ((pos = confpath.rfind("\\")) != std::string::npos) + else if (((pos = confpath.rfind("\\"))) != std::string::npos) newfile = confpath.substr(0, pos) + std::string("\\") + fname; + ServerInstance->Logs->Log("config", DEBUG, "Filename: %s", newfile.c_str()); + if (!FileExists(newfile.c_str())) return false; file = fopen(newfile.c_str(), "r"); @@ -1914,10 +1916,7 @@ bool ServerConfig::ReadFile(file_cache &F, const char* fname) else *linebuf = 0; - if (!feof(file)) - { - F.push_back(*linebuf ? linebuf : " "); - } + F.push_back(*linebuf ? linebuf : " "); } fclose(file); |