From: svost Date: Wed, 4 May 2016 12:51:06 +0000 (+0300) Subject: Fix coverity CID 74990 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=637be0c195f03d11e43c628e3b7b69242d0b10c4 Fix coverity CID 74990 --- diff --git a/src/util.cpp b/src/util.cpp index 744717c..1500e0f 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1246,8 +1246,9 @@ void ShrinkDebugFile() // Restart the file with some of the end try { vector* vBuf = new vector (200000, 0); - fseek(file, -((long)(vBuf->size())), SEEK_END); - size_t nBytes = fread(&vBuf->operator[](0), 1, vBuf->size(), file); + size_t nBytes = 1; //write one byte if fseek failed + if (fseek(file, -((long)(vBuf->size())), SEEK_END) == 0) + nBytes = fread(&vBuf->operator[](0), 1, vBuf->size(), file); fclose(file); file = fopen(pathLog.string().c_str(), "w"); if (file)