]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Patch from dz to fix bug 622 (config errors build up from /rehash to /rehash), thanks!
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 23 Oct 2008 18:07:07 +0000 (18:07 +0000)
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 23 Oct 2008 18:07:07 +0000 (18:07 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10690 e03df62e-2008-0410-955e-edbf42e46eb7

include/configreader.h
src/configreader.cpp

index 2ccabc5b4793bb03e36d66b8a9428af3df0a00f1..859e5bddb87b1a64c97576c7afc70262ed75a163 100644 (file)
@@ -349,7 +349,7 @@ class CoreExport ServerConfig : public Extensible
 
        /** Error stream, contains error output from any failed configuration parsing.
         */
-       std::ostringstream errstr;
+       std::ostringstream* errstr;
 
        /** Holds the new configuration when a rehash occurs so we dont overwrite the existing
         * working config with a broken one without checking it first and swapping pointers.
index 493bba8c9a9baf6de395eb2590c4cea2d9b871d0..50e86f4df3c4b4c64f85358aa7bfb0dfffa579f0 100644 (file)
@@ -747,7 +747,8 @@ void ServerConfig::Read(bool bail, const std::string &useruid)
        static char announceinvites[MAXBUF];    /* options:announceinvites setting */
        static char disabledumodes[MAXBUF]; /* Disabled usermodes */
        static char disabledcmodes[MAXBUF]; /* Disabled chanmodes */
-       errstr.clear();
+       /* std::ostringstream::clear() does not clear the string itself, only the error flags. */
+       this->errstr = new std::ostringstream(std::stringstream::in | std::stringstream::out);
 
        include_stack.clear();
 
@@ -940,11 +941,14 @@ void ServerConfig::Read(bool bail, const std::string &useruid)
        /* Make a copy here so if it fails then we can carry on running with an unaffected config */
        newconfig.clear();
 
-       if (!this->DoInclude(newconfig, ServerInstance->ConfigFileName, errstr))
+       if (!this->DoInclude(newconfig, ServerInstance->ConfigFileName, *errstr))
        {
-               ReportConfigError(errstr.str(), bail, useruid);
+               ReportConfigError(errstr->str(), bail, useruid);
+               delete errstr;
                return;
        }
+       
+       delete errstr;
 
        /* The stuff in here may throw CoreException, be sure we're in a position to catch it. */
        try