Compilation fails on systems where copy_file_range is already defined as a stub.
The prototype of copy_file_range in glibc returns an ssize_t, not an off_t. The function currently only exists on linux and freebsd, and in both cases the return type is ssize_t Signed-off-by: Manolo de Medici <manolo.demed...@gmail.com> --- block/file-posix.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 35684f7e21..f744b35642 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2000,12 +2000,13 @@ static int handle_aiocb_write_zeroes_unmap(void *opaque) } #ifndef HAVE_COPY_FILE_RANGE -static off_t copy_file_range(int in_fd, off_t *in_off, int out_fd, - off_t *out_off, size_t len, unsigned int flags) +ssize_t copy_file_range (int infd, off_t *pinoff, + int outfd, off_t *poutoff, + size_t length, unsigned int flags) { #ifdef __NR_copy_file_range - return syscall(__NR_copy_file_range, in_fd, in_off, out_fd, - out_off, len, flags); + return (ssize_t)syscall(__NR_copy_file_range, infd, pinoff, outfd, + poutoff, length, flags); #else errno = ENOSYS; return -1; -- 2.43.0