From 46f43132aadf89cbb362803335018bd96e0ab4dc Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 12 May 2008 16:00:34 +0000 Subject: 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 --- src/configreader.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/configreader.cpp') 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); -- cgit v1.3.1-10-gc9f91