Skip to content

Commit

Permalink
cat: fallback on EISDIR with copy_file_range(2)
Browse files Browse the repository at this point in the history
The filesystem may support reading directories directly
when security.bsd.allow_read_dir is set.

MFC after:	1 week
PR:		275099
  • Loading branch information
mmatuska committed Nov 19, 2023
1 parent 6000d46 commit 3c773ca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/cat/cat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 3c773ca

Please sign in to comment.