mirror of
https://github.com/postgres/postgres.git
synced 2025-05-31 00:01:57 -04:00
Check HAVE_COPY_FILE_RANGE before calling copy_file_range
Fix a mistake in ac8110155132 - write_reconstructed_file() called copy_file_range() without properly checking HAVE_COPY_FILE_RANGE. Reported by several macOS machines. Also reported by cfbot, but I missed that issue before commit.
This commit is contained in:
parent
ac81101551
commit
079d94ab34
@ -672,6 +672,7 @@ write_reconstructed_file(char *input_filename,
|
|||||||
}
|
}
|
||||||
else /* use copy_file_range */
|
else /* use copy_file_range */
|
||||||
{
|
{
|
||||||
|
#if defined(HAVE_COPY_FILE_RANGE)
|
||||||
/* copy_file_range modifies the offset, so use a local copy */
|
/* copy_file_range modifies the offset, so use a local copy */
|
||||||
off_t off = offsetmap[i];
|
off_t off = offsetmap[i];
|
||||||
size_t nwritten = 0;
|
size_t nwritten = 0;
|
||||||
@ -706,6 +707,9 @@ write_reconstructed_file(char *input_filename,
|
|||||||
if (pg_checksum_update(checksum_ctx, buffer, BLCKSZ) < 0)
|
if (pg_checksum_update(checksum_ctx, buffer, BLCKSZ) < 0)
|
||||||
pg_fatal("could not update checksum of file \"%s\"",
|
pg_fatal("could not update checksum of file \"%s\"",
|
||||||
output_filename);
|
output_filename);
|
||||||
|
#else
|
||||||
|
pg_fatal("copy_file_range not supported on this platform");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user