You've already forked pg_probackup
mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-09-16 09:26:30 +02:00
use _chsize_s on windows to grow file
This commit is contained in:
@@ -2717,21 +2717,19 @@ fio_send_file_write(FILE* out, send_file_state* st, char *buf, size_t len)
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifdef WIN32
|
||||||
|
if (st->read_size > st->write_size &&
|
||||||
|
_chsize_s(fileno(out), st->read_size) != 0)
|
||||||
|
{
|
||||||
|
elog(WARNING, "Could not change file size to %lld: %m", st->read_size)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (st->read_size > st->write_size &&
|
if (st->read_size > st->write_size &&
|
||||||
fseeko(out, st->read_size, SEEK_SET) != 0)
|
fseeko(out, st->read_size, SEEK_SET) != 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
while (st->read_size > st->write_size)
|
|
||||||
{
|
|
||||||
size_t wr = st->read_size - st->write_size;
|
|
||||||
wr = Min(wr, sizeof(zerobuf));
|
|
||||||
fwrite(zerobuf, 1, wr, out);
|
|
||||||
st->write_size += wr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fwrite(buf, 1, len, out) != len)
|
if (fwrite(buf, 1, len, out) != len)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user