aboutsummaryrefslogtreecommitdiff
path: root/src/logging.cpp
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2018-05-02 12:12:55 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2018-05-02 12:12:55 +0200
commit29c9bdcc141afb14fc9e1213f49de4fcded6ce0c (patch)
treecc332a0390a37bbbc01fbaf098bde75eab166de6 /src/logging.cpp
parent57c57df86f14874cfc4b280e04a7f44b19839c26 (diff)
Handle unsuccessful fseek(...):s
Diffstat (limited to 'src/logging.cpp')
-rw-r--r--src/logging.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/logging.cpp b/src/logging.cpp
index 10a3b18958..2a55d3665b 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<char> 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);