diff --git a/src/main.h b/src/main.h index 423891c3..262e77e8 100644 --- a/src/main.h +++ b/src/main.h @@ -944,9 +944,10 @@ public: fileout << FLATDATA(pchMessageStart) << nSize; // Write block - nBlockPosRet = ftell(fileout); - if (nBlockPosRet == -1) + long fileOutPos = ftell(fileout); + if (fileOutPos < 0) return error("CBlock::WriteToDisk() : ftell failed"); + nBlockPosRet = fileOutPos; fileout << *this; // Flush stdio buffers and commit to disk before returning