]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/files/file_store.cpp
Задействован метод GetConfModeDir (при создании каталога для сообщений)
[stg.git] / projects / stargazer / plugins / store / files / file_store.cpp
index 07638400fe1c0dd9177cfe1dd50cca523a986655..c27019d73f218fa30feea3a921127988c5bc24b0 100644 (file)
@@ -442,9 +442,9 @@ return confMode;
 mode_t FILES_STORE_SETTINGS::GetConfModeDir() const
 {
 mode_t mode = confMode;
-if (statMode & S_IRUSR) mode |= S_IXUSR;
-if (statMode & S_IRGRP) mode |= S_IXGRP;
-if (statMode & S_IROTH) mode |= S_IXOTH;
+if (confMode & S_IRUSR) mode |= S_IXUSR;
+if (confMode & S_IRGRP) mode |= S_IXGRP;
+if (confMode & S_IROTH) mode |= S_IXOTH;
 return mode;
 }
 //-----------------------------------------------------------------------------
@@ -1766,7 +1766,7 @@ switch (td.tariffConf.traffType)
 return 0;
 }
 //-----------------------------------------------------------------------------
-int FILES_STORE::WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> * statTree,
+int FILES_STORE::WriteDetailedStat(const map<IP_DIR_PAIR, STAT_NODE> & statTree,
                                    time_t lastStat,
                                    const string & login) const
 {
@@ -1895,13 +1895,14 @@ if (fprintf(statFile, "-> %02d.%02d.%02d - %02d.%02d.%02d\n",
     STG_LOCKER lock(&mutex, __FILE__, __LINE__);
     errorStr = string("fprint failed. Message: '") + strerror(errno) + "'";
     printfd(__FILE__, "FILES_STORE::WriteDetailStat - fprintf failed. Message: '%s'\n", strerror(errno));
+    fclose(statFile);
     return -1;
     }
 
 map<IP_DIR_PAIR, STAT_NODE>::const_iterator stIter;
-stIter = statTree->begin();
+stIter = statTree.begin();
 
-while (stIter != statTree->end())
+while (stIter != statTree.end())
     {
     string u, d;
     x2str(stIter->second.up, u);
@@ -1920,6 +1921,7 @@ while (stIter != statTree->end())
         errorStr += strerror(errno);
         errorStr += "'";
         printfd(__FILE__, "FILES_STORE::WriteDetailStat - fprintf failed. Message: '%s'\n", strerror(errno));
+        fclose(statFile);
         return -1;
         }
     #else
@@ -1935,6 +1937,7 @@ while (stIter != statTree->end())
         errorStr += strerror(errno);
         errorStr += "'";
         printfd(__FILE__, "FILES_STORE::WriteDetailStat - fprintf failed. Message: '%s'\n", strerror(errno));
+        fclose(statFile);
         return -1;
         }
     #endif
@@ -1981,7 +1984,7 @@ if (access(dn.c_str(), F_OK) != 0)
         }
     }
 
-chmod(dn.c_str(), storeSettings.GetConfMode() | S_IXUSR);
+chmod(dn.c_str(), storeSettings.GetConfModeDir());
 
 gettimeofday(&tv, NULL);
 
@@ -2214,4 +2217,3 @@ fclose(msgFile);
 return 0;
 }
 //-----------------------------------------------------------------------------
-