]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
util: copy_file_range() returns EBADF when used on a tty
authorLennart Poettering <lennart@poettering.net>
Thu, 21 Apr 2016 10:47:36 +0000 (12:47 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 25 Apr 2016 10:14:17 +0000 (12:14 +0200)
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 a44202e98b638024c45e50ad404c7069c7835c04.

src/basic/copy.c

index e2db4be9ff4deb96605f56ad8fe66e4e0ab93987..03487a6878da3f2351cccd64001f2a97f41e130d 100644 (file)
@@ -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;