Skip to content

Commit

Permalink
cat: report copy_file_range() errors with the read filename
Browse files Browse the repository at this point in the history
The error may be due to an error while writing, but it's more helpful to
report what we were trying to from rather than "stdout" for these
errors.  Noticed because of what happens now when `cat` gets an EISDIR
for reading from a dirfd:

kevans@ifrit:~$ cat /etc
cat: stdout: Is a directory

which, after this change, becomes:

kevans@aarch64-dev:~$ cat /etc
cat: /etc: Is a directory

Reviewed by:	allanjude, des, mm
Differential Revision:	https://reviews.freebsd.org/D41784
  • Loading branch information
kevans91 committed Dec 14, 2024
1 parent 17aec74 commit 86b4df9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/cat/cat.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ scanfiles(char *argv[], int cooked __unused)
errno == EISDIR)
raw_cat(fd);
else
err(1, "stdout");
err(1, "%s", filename);
}
#else
raw_cat(fd);
Expand Down

0 comments on commit 86b4df9

Please sign in to comment.