Skip to content

Commit

Permalink
Merge pull request #620 from dukess/master
Browse files Browse the repository at this point in the history
Fix: overwrite buffer in cleanupDatalog()
  • Loading branch information
fredlcore authored Feb 25, 2024
2 parents 441eba2 + 833ea2c commit 32eeec3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion BSB_LAN/BSB_LAN.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6551,7 +6551,11 @@ next_parameter:
} else if (p[2]=='K') { //--- clean up datalog, keeping only the most recent n days
int nDays;
if (sscanf(p+3,"%d",&nDays)==1 && nDays>0) {
printFmtToWebClient("\r\n%s\r\n",cleanupDatalog(nDays));
// We should flush all characters to client and use errormsgptr
// beacuse cleanupDatalog() and printFmtToWebClient() use same buffer;
flushToWebClient();
const char *errormsgptr = cleanupDatalog(nDays);
printFmtToWebClient("\r\n%s\r\n", errormsgptr);
// cleanup after failed cleanupDatalog(), if necessary:
SD.remove(datalogTemporaryFileName);
SD.remove(datalogIndexTemporaryFileName);
Expand Down

0 comments on commit 32eeec3

Please sign in to comment.