From d535ca4c06872a280ba65304036ff86d3fb5cb0e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 19 Sep 2025 08:55:12 -0700 Subject: [PATCH] copy: pacify older clang * src/copy-file-data.c (copy_file_data): Redo conditionals for clarity. This pacifies the clang in FreeBSD 11 and OpenBSD 7.6. Problem reported by Bruno Haible in: https://lists.gnu.org/r/coreutils/2025-09/msg00104.html --- src/copy-file-data.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/copy-file-data.c b/src/copy-file-data.c index 44b542de00..1eefd3071f 100644 --- a/src/copy-file-data.c +++ b/src/copy-file-data.c @@ -571,18 +571,19 @@ copy_file_data (int ifd, struct stat const *ist, off_t ipos, char const *iname, intmax_t result; off_t hole_size = 0; -#ifdef SEEK_HOLE if (scantype == LSEEK_SCANTYPE) - result = lseek_copy (ifd, ofd, &buf, buf_size, - ipos, ibytes, &scan_inference, ist->st_size, - make_holes ? x->sparse_mode : SPARSE_NEVER, - x->reflink_mode != REFLINK_NEVER, - iname, oname, &hole_size, debug); + { +#ifdef SEEK_HOLE + result = lseek_copy (ifd, ofd, &buf, buf_size, + ipos, ibytes, &scan_inference, ist->st_size, + make_holes ? x->sparse_mode : SPARSE_NEVER, + x->reflink_mode != REFLINK_NEVER, + iname, oname, &hole_size, debug); #else - assume (scantype != LSEEK_SCANTYPE); + unreachable (); #endif - - if (scantype != LSEEK_SCANTYPE) + } + else result = sparse_copy (ifd, ofd, &buf, buf_size, x->reflink_mode != REFLINK_NEVER, iname, oname, ibytes, -- 2.47.3