Skip to content

Commit

Permalink
util: copy_file_range() returns EBADF when used on a tty
Browse files Browse the repository at this point in the history
In nspawn we invoke copy_bytes() on a TTY fd. copy_file_range() returns EBADF
on a TTY and this error is considered fatal by copy_bytes() so far. Correct
that, so that nspawn's copy_bytes() operation works again.

This is a follow-up for a44202e.
  • Loading branch information
poettering committed Apr 25, 2016
1 parent 4f4d6ee commit 6402d5c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/basic/copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ int copy_bytes(int fdf, int fdt, uint64_t max_bytes, bool try_reflink) {
if (try_cfr) {
n = try_copy_file_range(fdf, NULL, fdt, NULL, m, 0u);
if (n < 0) {
if (!IN_SET(n, -EINVAL, -ENOSYS, -EXDEV))
if (!IN_SET(n, -EINVAL, -ENOSYS, -EXDEV, -EBADF))
return n;

try_cfr = false;
Expand Down

0 comments on commit 6402d5c

Please sign in to comment.