From 913339f11813f8aa48d9c6cb622f5d93ac3a0cc0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Apr 2018 17:50:25 +0300 Subject: [PATCH] Test --- src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 8ebf364ab..1fb70bafc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4037,7 +4037,7 @@ bool CheckDiskSpace(uint64_t nAdditionalBytes) FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly) { - int32_t incr; + static int32_t didinit; long fsize,fpos; int32_t incr = 16*1024*1024; if (pos.IsNull()) return NULL; boost::filesystem::path path = GetBlockPosFilename(pos, prefix); @@ -4049,9 +4049,8 @@ FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly) LogPrintf("Unable to open file %s\n", path.string()); return NULL; } - if ( strcmp(prefix,(char *)"blk") == 0 ) + if ( didinit == 0 && strcmp(prefix,(char *)"blk") == 0 ) { - long fsize,fpos; int32_t incr = 16*1024*1024; fpos = ftell(file); fseek(file,0,SEEK_END); fsize = ftell(file); @@ -4068,6 +4067,7 @@ FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly) } } fseek(file,fpos,SEEK_SET); + didinit = 1; } if (pos.nPos) { if (fseek(file, pos.nPos, SEEK_SET)) {