mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Merge #13149: Handle unsuccessful fseek(...):s
20ce5afPrint a log message if we fail to shrink the debug log file (practicalswift)29c9bdcHandle unsuccessful fseek(...):s (practicalswift) Pull request description: Handle unsuccessful `fseek(...)`:s. **Note to reviewers:** What is the most appropriate course of actions for each of these unsuccessful `fseek(...)`:s? Tree-SHA512: 5b3d82dbdd15d434d3f08dcb4df62888da4df8541d2586f56a4e529083005f6782c39e10645acd1ec403da83061bbfd8dbf2dddc66e09268d410ad0918c61876
This commit is contained in:
commit
bd83704ec6
3 changed files with 11 additions and 3 deletions
|
|
@ -253,7 +253,11 @@ void BCLog::Logger::ShrinkDebugFile()
|
|||
{
|
||||
// Restart the file with some of the end
|
||||
std::vector<char> vch(RECENT_DEBUG_HISTORY_SIZE, 0);
|
||||
fseek(file, -((long)vch.size()), SEEK_END);
|
||||
if (fseek(file, -((long)vch.size()), SEEK_END)) {
|
||||
LogPrintf("Failed to shrink debug log file: fseek(...) failed\n");
|
||||
fclose(file);
|
||||
return;
|
||||
}
|
||||
int nBytes = fread(vch.data(), 1, vch.size(), file);
|
||||
fclose(file);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue