diff -Naur postgresql-10.1.orig/src/bin/pg_rewind/copy_fetch.c postgresql-10.1/src/bin/pg_rewind/copy_fetch.c
--- postgresql-10.1.orig/src/bin/pg_rewind/copy_fetch.c	2017-11-07 01:46:52.000000000 +0100
+++ postgresql-10.1/src/bin/pg_rewind/copy_fetch.c	2018-02-04 13:55:22.417162961 +0100
@@ -156,7 +156,7 @@
  * If 'trunc' is true, any existing file with the same name is truncated.
  */
 static void
-copy_file_range(const char *path, off_t begin, off_t end, bool trunc)
+pg_copy_file_range(const char *path, off_t begin, off_t end, bool trunc)
 {
 	char		buf[BLCKSZ];
 	char		srcpath[MAXPGPATH];
@@ -222,7 +222,7 @@
 				break;
 
 			case FILE_ACTION_COPY:
-				copy_file_range(entry->path, 0, entry->newsize, true);
+				pg_copy_file_range(entry->path, 0, entry->newsize, true);
 				break;
 
 			case FILE_ACTION_TRUNCATE:
@@ -230,7 +230,7 @@
 				break;
 
 			case FILE_ACTION_COPY_TAIL:
-				copy_file_range(entry->path, entry->oldsize, entry->newsize, false);
+				pg_copy_file_range(entry->path, entry->oldsize, entry->newsize, false);
 				break;
 
 			case FILE_ACTION_CREATE:
@@ -257,7 +257,7 @@
 	while (datapagemap_next(iter, &blkno))
 	{
 		offset = blkno * BLCKSZ;
-		copy_file_range(path, offset, offset + BLCKSZ, false);
+		pg_copy_file_range(path, offset, offset + BLCKSZ, false);
 		/* Ok, this block has now been copied from new data dir to old */
 	}
 	pg_free(iter);
