From 29c9bdcc141afb14fc9e1213f49de4fcded6ce0c Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 2 May 2018 12:12:55 +0200 Subject: Handle unsuccessful fseek(...):s --- src/logging.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/logging.cpp') diff --git a/src/logging.cpp b/src/logging.cpp index 10a3b1895..2a55d3665 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -254,7 +254,10 @@ void BCLog::Logger::ShrinkDebugFile() { // Restart the file with some of the end std::vector vch(RECENT_DEBUG_HISTORY_SIZE, 0); - fseek(file, -((long)vch.size()), SEEK_END); + if (fseek(file, -((long)vch.size()), SEEK_END)) { + fclose(file); + return; + } int nBytes = fread(vch.data(), 1, vch.size(), file); fclose(file); -- cgit v1.2.3