Skip to content

Commit c3588b0

Browse files
committed
Init (or remap) the shared memory file of size 2GB to 4GB in the right way.
This should fix #8487: Unexpected error on Firebird 5.0.1 SuperServer
1 parent 2f703ab commit c3588b0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/common/isc_sync.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,10 @@ SharedMemoryBase::SharedMemoryBase(const TEXT* filename, ULONG length, IpcObject
17231723
(Arg::Gds(isc_random) << Arg::Str("File for memory mapping is empty.")).raise();
17241724
}
17251725

1726-
if (SetFilePointer(file_handle, length, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER ||
1726+
LARGE_INTEGER offset;
1727+
offset.QuadPart = length;
1728+
1729+
if (SetFilePointer(file_handle, offset.LowPart, &offset.HighPart, FILE_BEGIN) == INVALID_SET_FILE_POINTER ||
17271730
!SetEndOfFile(file_handle) || !FlushFileBuffers(file_handle))
17281731
{
17291732
err = GetLastError();
@@ -2564,7 +2567,10 @@ bool SharedMemoryBase::remapFile(CheckStatusWrapper* statusVector,
25642567

25652568
if (flag)
25662569
{
2567-
if (SetFilePointer(sh_mem_handle, new_length, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER ||
2570+
LARGE_INTEGER offset;
2571+
offset.QuadPart = new_length;
2572+
2573+
if (SetFilePointer(sh_mem_handle, offset.LowPart, &offset.HighPart, FILE_BEGIN) == INVALID_SET_FILE_POINTER ||
25682574
!SetEndOfFile(sh_mem_handle) ||
25692575
!FlushViewOfFile(sh_mem_header, 0))
25702576
{

0 commit comments

Comments
 (0)