aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.h b/src/main.h
index 423891c3bc..262e77e806 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