Skip to content
Snippets Groups Projects
Commit 69e23e72 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Move the backup of dsts.ini before opening the file

Can't backup (make copies of) an open file.
parent 5f7ac817
No related branches found
No related tags found
No related merge requests found
......@@ -646,6 +646,8 @@ uint sbbs_t::logonstats()
node.misc|=NODE_EVENT;
putnodedat(i,&node);
}
dstats_fname(&cfg, i, path, sizeof path);
backup(path, 90, /* rename: */false);
if((dsts = fopen_dstats(&cfg, i, /* for_write: */TRUE)) == NULL) /* doesn't have stats yet */
continue;
......@@ -655,14 +657,12 @@ uint sbbs_t::logonstats()
continue;
}
dstats_fname(&cfg, i, path, sizeof path);
if(!fread_dstats(dsts, &stats)) {
errormsg(WHERE, ERR_READ, path, i);
} else {
stats.date = time(NULL);
fwrite_cstats(csts, &stats);
rolloverstats(&stats);
backup(path, 90, /* rename: */false);
if(!fwrite_dstats(dsts, &stats, __FUNCTION__))
errormsg(WHERE, ERR_WRITE, path, i);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment