Fix crash on Windows when dumping admin cache to file.

This commit is contained in:
Nicholas Hastings
2014-10-08 17:31:02 -07:00
parent ac96bb177a
commit 512fae4c25
5 changed files with 16 additions and 12 deletions
+11 -1
View File
@@ -1762,7 +1762,7 @@ void iterator_group_grp_override(FILE *fp, const char *key, OverrideRule rule)
fprintf(fp, "\t\t\t\"@%s\"\t\t\"%s\"\n", key, str);
}
void AdminCache::DumpCache(FILE *fp)
bool AdminCache::DumpCache(const char *filename)
{
int *itable;
AdminId aid;
@@ -1771,6 +1771,12 @@ void AdminCache::DumpCache(FILE *fp)
unsigned int num;
AdminUser *pAdmin;
AdminGroup *pGroup;
FILE *fp;
if ((fp = fopen(filename, "wt")) == NULL)
{
return false;
}
fprintf(fp, "\"Groups\"\n{\n");
@@ -1901,6 +1907,10 @@ void AdminCache::DumpCache(FILE *fp)
for (FlagMap::iterator iter = m_CmdOverrides.iter(); !iter.empty(); iter.next())
iterator_glob_basic_override(fp, iter->key.chars(), iter->value);
fprintf(fp, "}\n");
fclose(fp);
return true;
}
AdminGroup *AdminCache::GetGroup(GroupId gid)