diff options
-rw-r--r-- | src/util/system.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp index efd35bed55..6925bda4ef 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -1085,11 +1085,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] = {}; |