mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Handle the result of posix_fallocate system call
This commit is contained in:
parent
7b13c64645
commit
5d35ae3326
@ -1089,11 +1089,12 @@ void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length) {
|
||||
fcntl(fileno(file), F_PREALLOCATE, &fst);
|
||||
}
|
||||
ftruncate(fileno(file), fst.fst_length);
|
||||
#elif defined(__linux__)
|
||||
#else
|
||||
#if defined(__linux__)
|
||||
// Version using posix_fallocate
|
||||
off_t nEndPos = (off_t)offset + length;
|
||||
posix_fallocate(fileno(file), 0, nEndPos);
|
||||
#else
|
||||
if (0 == posix_fallocate(fileno(file), 0, nEndPos)) return;
|
||||
#endif
|
||||
// Fallback version
|
||||
// TODO: just write one byte per block
|
||||
static const char buf[65536] = {};
|
||||
|
Loading…
Reference in New Issue
Block a user