git: a4d16707a81b - stable/14 - cat: fallback on EISDIR with copy_file_range(2)

From: Martin Matuska <mm_at_FreeBSD.org>
Date: Sun, 26 Nov 2023 00:25:59 UTC
The branch stable/14 has been updated by mm:

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

commit a4d16707a81b13cb711a4a75843d5d24486de150
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2023-11-19 01:09:34 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2023-11-26 00:24:42 +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.
    
    PR:             275099
    
    (cherry picked from commit 3c773cad57064c23873f286fbec69f6f0305b889)
---
 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 ec14451acd0c..1468faf494a3 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");