CBlock::WriteToDisk() properly checks ftell(3) for error return
Rather than storing ftell(3)'s return value -- a long -- in an unsigned int, we store and check a properly typed temp. Then, assured a non-negative value, we store in nBlockPosRet.
This commit is contained in:
parent
1d8c7a9557
commit
5aa0b23825
1 changed files with 3 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue