Skip to content

Commit 2dff085

Browse files
committed
Bug#33727629 Misc fixes for ndb_file on Windows
In ndb_file_win32.cpp do not assume extend function is always called at beginning of file. That was true for raw files but not when using ndbxfrm1 for redo, undo, table space files. Change-Id: I658d5089eaabde18908b3d5b93977900f59db1c2
1 parent 88f9c5a commit 2dff085

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

storage/ndb/src/common/portlib/ndb_file_win32.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ ndb_file::off_t ndb_file::get_size() const
240240
int ndb_file::extend(off_t end, extend_flags flags) const
241241
{
242242
require(check_block_size_and_alignment(nullptr, end, end));
243+
const off_t saved_file_pos = get_pos();
244+
if (saved_file_pos == -1)
245+
{
246+
return -1;
247+
}
243248
const off_t size = get_size();
244249
if (size == -1)
245250
{
@@ -280,7 +285,10 @@ int ndb_file::extend(off_t end, extend_flags flags) const
280285
SetLastError(0);
281286
}
282287
}
283-
set_pos(0);
288+
if (set_pos(saved_file_pos) == -1)
289+
{
290+
return -1;
291+
}
284292
return 0;
285293
}
286294

0 commit comments

Comments
 (0)