]> git.stg.codes - stg.git/blobdiff - projects/stargazer/settings_impl.cpp
Fix settings error reporting mechanism
[stg.git] / projects / stargazer / settings_impl.cpp
index 0d0bc2ff0265c9402224b1ac0a197089b3580e8e..d5fb2dad0b6366369ddcf672ab6696b20386fcb2 100644 (file)
@@ -32,9 +32,9 @@ $Author: faust $
 #include <cerrno>
 #include <string>
 
+#include "stg/logger.h"
+#include "stg/dotconfpp.h"
 #include "settings_impl.h"
-#include "stg_logger.h"
-#include "dotconfpp.h"
 
 using namespace std;
 
@@ -42,6 +42,7 @@ using namespace std;
 SETTINGS_IMPL::SETTINGS_IMPL()
     : strError(),
       modulesPath("/usr/lib/stg"),
+      dirName(DIR_NUM),
       confDir("/etc/stargazer"),
       scriptsDir("/etc/stargazer"),
       rules("/etc/stargazer/rules"),
@@ -71,6 +72,7 @@ SETTINGS_IMPL::SETTINGS_IMPL()
 SETTINGS_IMPL::SETTINGS_IMPL(const std::string & cd)
     : strError(),
       modulesPath("/usr/lib/stg"),
+      dirName(DIR_NUM),
       confDir(cd),
       scriptsDir(cd),
       rules(cd + "/rules"),
@@ -100,6 +102,7 @@ SETTINGS_IMPL::SETTINGS_IMPL(const std::string & cd)
 SETTINGS_IMPL::SETTINGS_IMPL(const SETTINGS_IMPL & rval)
     : strError(),
       modulesPath(rval.modulesPath),
+      dirName(rval.dirName),
       confDir(rval.confDir),
       scriptsDir(rval.scriptsDir),
       rules(rval.rules),
@@ -232,9 +235,9 @@ return 0;
 //-----------------------------------------------------------------------------
 void SETTINGS_IMPL::ErrorCallback(void * data, const char * buf)
 {
-    printfd(__FILE__, buf);
+    printfd(__FILE__, "SETTINGS_IMPL::ErrorCallback() - %s\n", buf);
     SETTINGS_IMPL * settings = static_cast<SETTINGS_IMPL *>(data);
-    settings->logger(buf);
+    settings->logger("%s", buf);
 }
 //-----------------------------------------------------------------------------
 int SETTINGS_IMPL::ReadSettings()
@@ -432,6 +435,7 @@ while (node)
         if (child)
             {
             const DOTCONFDocumentNode * dirNameNode;
+            dirName.reserve(DIR_NUM);
             for (int i = 0; i < DIR_NUM; i++)
                 {
                 char strDirName[12];