Skip to content

Commit 91708df

Browse files
TreeHunter9Artyom Ivanov
andauthored
Backport of fix(pio): Replace 32-bit offset calculation with 64-bit in PIO_extend (#8709)
Co-authored-by: Artyom Ivanov <artyom.ivanov@red-soft.ru>
1 parent 27cb4de commit 91708df

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/jrd/os/posix/unix.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,13 @@ void PIO_extend(thread_db* tdbb, jrd_file* main_file, const ULONG extPages, cons
333333

334334
const ULONG extendBy = MIN(fileMaxPages - filePages + file->fil_fudge, leftPages);
335335

336+
const off_t offset = static_cast<off_t>(filePages) * pageSize;
337+
const off_t length = static_cast<off_t>(extendBy) * pageSize;
338+
336339
int r;
337340
for (r = 0; r < IO_RETRY; r++)
338341
{
339-
int err = fallocate(file->fil_desc, 0, filePages * pageSize, extendBy * pageSize);
342+
int err = fallocate(file->fil_desc, 0, offset, length);
340343
if (err == 0)
341344
break;
342345

0 commit comments

Comments
 (0)