Skip to content

Commit 079d94a

Browse files
committed
Check HAVE_COPY_FILE_RANGE before calling copy_file_range
Fix a mistake in ac81101 - 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.
1 parent ac81101 commit 079d94a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/bin/pg_combinebackup/reconstruct.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,7 @@ write_reconstructed_file(char *input_filename,
672672
}
673673
else /* use copy_file_range */
674674
{
675+
#if defined(HAVE_COPY_FILE_RANGE)
675676
/* copy_file_range modifies the offset, so use a local copy */
676677
off_t off = offsetmap[i];
677678
size_t nwritten = 0;
@@ -706,6 +707,9 @@ write_reconstructed_file(char *input_filename,
706707
if (pg_checksum_update(checksum_ctx, buffer, BLCKSZ) < 0)
707708
pg_fatal("could not update checksum of file \"%s\"",
708709
output_filename);
710+
#else
711+
pg_fatal("copy_file_range not supported on this platform");
712+
#endif
709713
}
710714
}
711715

0 commit comments

Comments
 (0)