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

Don't rollover daily stats (dsts.ini) if the previous date was Jan-1-1970 UTC

This date (basically 0) means either the dsts.ini file doesn't exist or there
was an issue reading it successfully (that was not detected by getstats()).
parent d9f9c194
No related branches found
No related tags found
No related merge requests found
Pipeline #7103 passed
......@@ -616,6 +616,7 @@ uint sbbs_t::logonstats()
return 0;
}
if(stats.date != 0) {
now=time(NULL);
if(stats.date > now+(24L*60L*60L)) /* More than a day in the future? */
errormsg(WHERE,ERR_CHK,"Daily stats date/time stamp", (ulong)stats.date);
......@@ -654,20 +655,22 @@ uint sbbs_t::logonstats()
continue;
}
dstats_fname(&cfg, i, path, sizeof path);
if(!fread_dstats(dsts, &stats)) {
errormsg(WHERE, ERR_READ, "dsts.ini", i);
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, "dsts.ini", i);
errormsg(WHERE, ERR_WRITE, path, i);
}
fclose_dstats(dsts);
fclose_cstats(csts);
}
}
}
if(cfg.node_num==0) /* called from event_thread() */
return(0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment