From 7baa9906839e7affe226f3fbca092d594b903753 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 19 Mar 2022 19:57:46 -0500 Subject: [PATCH] Fix copy_file_range() fallback. --- lib/portability.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/portability.c b/lib/portability.c index 0d02309d..174933c3 100644 --- a/lib/portability.c +++ b/lib/portability.c @@ -651,8 +651,11 @@ long long sendfile_len(int in, int out, long long bytes, long long *consumed) if (copy_file_range) { if (bytes<0 || bytes>(1<<30)) len = (1<<30); len = copy_file_range_wrap(in, 0, out, 0, len, 0); - if (len < 0 && errno == EINVAL) + if (len < 0 && errno == EINVAL) { copy_file_range = 0; + + continue; + } } if (!copy_file_range) { if (bytes<0 || len>sizeof(libbuf)) len = sizeof(libbuf); -- 2.39.2