]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/files/file_store.cpp
Add tables update on user add and del
[stg.git] / projects / stargazer / plugins / store / files / file_store.cpp
index 1a16ed91146d178fef2a15c5e1ed9aa7b8dab324..62c2519b976a343cdf88fe59847b93dbcc89623b 100644 (file)
@@ -532,6 +532,7 @@ while ((entry = readdir(d)))
             errorStr += strerror(errno);
             errorStr += "'";
             printfd(__FILE__, "FILES_STORE::RemoveDir() - unlink failed. Message: '%s'\n", strerror(errno));
+            closedir(d);
             return -1;
             }
         }
@@ -540,6 +541,7 @@ while ((entry = readdir(d)))
         {
         if (RemoveDir(str.c_str()))
             {
+            closedir(d);
             return -1;
             }
 
@@ -1179,10 +1181,10 @@ if (s2.Error())
 for (size_t i = 0; i < DIR_NUM; i++)
     {
     char dirName[3];
-    snprintf(dirName, 3, "U%d", i);
+    snprintf(dirName, 3, "U%llu", (unsigned long long)i);
     s.WriteInt(dirName, stat.up[i]); // Classic
     s2.WriteInt(dirName, stat.up[i]); // New
-    snprintf(dirName, 3, "D%d", i);
+    snprintf(dirName, 3, "D%llu", (unsigned long long)i);
     s.WriteInt(dirName, stat.down[i]); // Classic
     s2.WriteInt(dirName, stat.down[i]); // New
     }
@@ -1280,6 +1282,8 @@ strprintf(&fileName, "%s/%s.adm", storeSettings.GetAdminsDir().c_str(), ac.login
     cf.WriteInt("UsrAddDel",   ac.priv.userAddDel);
     cf.WriteInt("ChgTariff",   ac.priv.tariffChg);
     cf.WriteInt("ChgAdmin",    ac.priv.adminChg);
+    cf.WriteInt("ChgService",  ac.priv.serviceChg);
+    cf.WriteInt("ChgCorp",     ac.priv.corpChg);
     }
 
 return 0;
@@ -1407,6 +1411,16 @@ else
     return -1;
     }
 
+if (cf.ReadInt("ChgService", &a, 0) == 0)
+    ac->priv.serviceChg = a;
+else
+    ac->priv.serviceChg = 0;
+
+if (cf.ReadInt("ChgCorp", &a, 0) == 0)
+    ac->priv.corpChg = a;
+else
+    ac->priv.corpChg = 0;
+
 return 0;
 }
 //-----------------------------------------------------------------------------