diff --git a/src/sbbs3/logon.cpp b/src/sbbs3/logon.cpp index 78358189f0f2c4a40e5b65b9fad1c449f70e5402..040418306a3f976d6c0cf69198a9acf7d839392a 100644 --- a/src/sbbs3/logon.cpp +++ b/src/sbbs3/logon.cpp @@ -652,12 +652,15 @@ uint sbbs_t::logonstats() continue; } - fread_dstats(dsts, &stats); - stats.date = time(NULL); - fwrite_cstats(csts, &stats); - fclose_cstats(csts); - rolloverstats(&stats); - fwrite_dstats(dsts, &stats, __FUNCTION__); + if(!fread_dstats(dsts, &stats)) { + errormsg(WHERE, ERR_READ, "dsts.ini", i); + } else { + stats.date = time(NULL); + fwrite_cstats(csts, &stats); + fclose_cstats(csts); + rolloverstats(&stats); + fwrite_dstats(dsts, &stats, __FUNCTION__); + } fclose_dstats(dsts); } } @@ -677,10 +680,13 @@ uint sbbs_t::logonstats() errormsg(WHERE, ERR_OPEN, "dsts.ini", i); return(0L); } - fread_dstats(fp, &stats); - stats.today.logons++; - stats.total.logons++; - fwrite_dstats(fp, &stats, __FUNCTION__); + if(!fread_dstats(fp, &stats)) { + errormsg(WHERE, ERR_READ, "dsts.ini", i); + } else { + stats.today.logons++; + stats.total.logons++; + fwrite_dstats(fp, &stats, __FUNCTION__); + } fclose_dstats(fp); } diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp index 34b3f110e4f80222526fa00d3c907ce71f10c8e4..53d28a63f00118e76a85dd813f8c92ffd8ae2125 100644 --- a/src/sbbs3/main.cpp +++ b/src/sbbs3/main.cpp @@ -4379,7 +4379,9 @@ void sbbs_t::logoffstats() FILE* fp = fopen_dstats(&cfg, i ? 0 : cfg.node_num, /* for_write: */true); if(fp == NULL) continue; - if(fread_dstats(fp, &stats)) { + if(!fread_dstats(fp, &stats)) { + errormsg(WHERE, ERR_READ, "dsts.ini", i); + } else { stats.total.timeon += minutes_used; stats.today.timeon += minutes_used; fwrite_dstats(fp, &stats, __FUNCTION__);