git: 3c773cad5706 - main - cat: fallback on EISDIR with copy_file_range(2)

From: Martin Matuska <mm_at_FreeBSD.org>
Date: Sun, 19 Nov 2023 01:15:41 UTC
The branch main has been updated by mm:

URL: https://cgit.FreeBSD.org/src/commit/?id=3c773cad57064c23873f286fbec69f6f0305b889

commit 3c773cad57064c23873f286fbec69f6f0305b889
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2023-11-19 01:09:34 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2023-11-19 01:14:50 +0000

    cat: fallback on EISDIR with copy_file_range(2)
    
    The filesystem may support reading directories directly
    when security.bsd.allow_read_dir is set.
    
    MFC after:      1 week
    PR:             275099
---
 bin/cat/cat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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