diff --git a/src/jrd/os/posix/unix.cpp b/src/jrd/os/posix/unix.cpp index 7a146367750..be76793eddd 100644 --- a/src/jrd/os/posix/unix.cpp +++ b/src/jrd/os/posix/unix.cpp @@ -333,10 +333,13 @@ void PIO_extend(thread_db* tdbb, jrd_file* main_file, const ULONG extPages, cons const ULONG extendBy = MIN(fileMaxPages - filePages + file->fil_fudge, leftPages); + const off_t offset = static_cast(filePages) * pageSize; + const off_t length = static_cast(extendBy) * pageSize; + int r; for (r = 0; r < IO_RETRY; r++) { - int err = fallocate(file->fil_desc, 0, filePages * pageSize, extendBy * pageSize); + int err = fallocate(file->fil_desc, 0, offset, length); if (err == 0) break;