summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Vondra2024-04-05 17:38:16 +0000
committerTomas Vondra2024-04-05 17:38:20 +0000
commit079d94ab3412fdeda637a24b17bde53c576b0007 (patch)
tree5a4bb0b138498d9426d31235d099ff23f9a65b18
parentac81101551326ddf4c5cb804c75bd3e8c56506ba (diff)
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.
-rw-r--r--src/bin/pg_combinebackup/reconstruct.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bin/pg_combinebackup/reconstruct.c b/src/bin/pg_combinebackup/reconstruct.c
index b059be8d0a6..15f62c18df8 100644
--- a/src/bin/pg_combinebackup/reconstruct.c
+++ b/src/bin/pg_combinebackup/reconstruct.c
@@ -672,6 +672,7 @@ write_reconstructed_file(char *input_filename,
}
else /* use copy_file_range */
{
+#if defined(HAVE_COPY_FILE_RANGE)
/* copy_file_range modifies the offset, so use a local copy */
off_t off = offsetmap[i];
size_t nwritten = 0;
@@ -706,6 +707,9 @@ write_reconstructed_file(char *input_filename,
if (pg_checksum_update(checksum_ctx, buffer, BLCKSZ) < 0)
pg_fatal("could not update checksum of file \"%s\"",
output_filename);
+#else
+ pg_fatal("copy_file_range not supported on this platform");
+#endif
}
}