The branch main has been updated by mm:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=055f920ebe21b8e05235363bc11a83cc649cdc6a

commit 055f920ebe21b8e05235363bc11a83cc649cdc6a
Author:     Martin Matuska <m...@freebsd.org>
AuthorDate: 2023-07-08 23:04:25 +0000
Commit:     Martin Matuska <m...@freebsd.org>
CommitDate: 2023-07-08 23:08:46 +0000

    cat: fallback on EBADF with copy_file_range(2)
    
    When stdout is opened with O_APPEND, copy_file_range(2) fails with EBADF.
---
 bin/cat/cat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/cat/cat.c b/bin/cat/cat.c
index 1158a839cfd8..44a406dd037b 100644
--- a/bin/cat/cat.c
+++ b/bin/cat/cat.c
@@ -283,7 +283,7 @@ scanfiles(char *argv[], int cooked __unused)
                } else {
 #ifndef BOOTSTRAP_CAT
                        if (in_kernel_copy(fd) == -1) {
-                               if (errno == EINVAL)
+                               if (errno == EINVAL || errno == EBADF)
                                        raw_cat(fd);
                                else
                                        err(1, "stdout");

Reply via email to