diff --git a/src/internal/poll/copy_file_range_freebsd.go b/src/internal/poll/copy_file_range_freebsd.go index 47d0de04ea..63fa013e46 100644 --- a/src/internal/poll/copy_file_range_freebsd.go +++ b/src/internal/poll/copy_file_range_freebsd.go @@ -22,7 +22,7 @@ func handleCopyFileRangeErr(err error, copied, written int64) (bool, error) { switch err { case syscall.ENOSYS: // The copy_file_range(2) function first appeared in FreeBSD 13.0. - // Go supports FreeBSD>= 12, so the system call + // Go supports FreeBSD >= 12, so the system call // may not be present. We've detected the FreeBSD version with // unix.SupportCopyFileRange() at the beginning of this function, // but we still want to check for ENOSYS here to prevent some rare diff --git a/src/internal/poll/copy_file_range_unix.go b/src/internal/poll/copy_file_range_unix.go index 73193a1991..833d553a27 100644 --- a/src/internal/poll/copy_file_range_unix.go +++ b/src/internal/poll/copy_file_range_unix.go @@ -24,7 +24,7 @@ func CopyFileRange(dst, src *FD, remain int64) (written int64, handled bool, err max = maxCopyFileRangeRound } n, e := copyFileRange(dst, src, int(max)) - if e == nil { + if n > 0 { remain -= n written += n }