Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d672166

Browse filesBrowse files
committed
Use _chsize_s on windows to grow file
Looks like "seek after file end and write" doesn't work correctly in Windows. We have to grow file before. Met occasionally on GitHub actions run. Could not reproduce locally.
1 parent b7551bd commit d672166
Copy full SHA for d672166

File tree

1 file changed

+8
-0
lines changed
Filter options

1 file changed

+8
-0
lines changed

‎src/utils/file.c

Copy file name to clipboardExpand all lines: src/utils/file.c
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2717,6 +2717,14 @@ fio_send_file_write(FILE* out, send_file_state* st, char *buf, size_t len)
27172717
if (len == 0)
27182718
return true;
27192719

2720+
#ifdef WIN32
2721+
if (st->read_size > st->write_size &&
2722+
_chsize_s(fileno(out), st->read_size) != 0)
2723+
{
2724+
elog(WARNING, "Could not change file size to %lld: %m", st->read_size);
2725+
return false;
2726+
}
2727+
#endif
27202728
if (st->read_size > st->write_size &&
27212729
fseeko(out, st->read_size, SEEK_SET) != 0)
27222730
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.