1913 | @@ -1914,11 +1914,13 @@ bool FindBlockPos(CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeigh
1914 | unsigned int nOldChunks = (pos.nPos + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE;
1915 | unsigned int nNewChunks = (infoLastBlockFile.nSize + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE;
1916 | if (nNewChunks > nOldChunks) {
1917 | - FILE *file = OpenBlockFile(pos);
1918 | - if (file) {
1919 | - printf("Pre-allocating up to position 0x%x in blk%05u.dat\n", nNewChunks * BLOCKFILE_CHUNK_SIZE, pos.nFile);
1920 | - AllocateFileRange(file, pos.nPos, nNewChunks * BLOCKFILE_CHUNK_SIZE - pos.nPos);
1921 | - fclose(file);
1922 | + if (CheckDiskSpace(nNewChunks * BLOCKFILE_CHUNK_SIZE - pos.nPos)) {
In case there is not enough disk space to do pre-allocation, we probably want to fail gracefully, instead of not just preallocating.
@sipa See below, we now return error() on a failed check.