File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1162,7 +1162,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
1162
1162
} ;
1163
1163
if let Err ( ref copy_err) = copy_result {
1164
1164
match copy_err. raw_os_error ( ) {
1165
- Some ( libc:: ENOSYS ) | Some ( libc:: EPERM ) => {
1165
+ Some ( libc:: ENOSYS ) | Some ( libc:: EPERM ) | Some ( libc :: EOPNOTSUPP ) => {
1166
1166
HAS_COPY_FILE_RANGE . store ( false , Ordering :: Relaxed ) ;
1167
1167
}
1168
1168
_ => { }
@@ -1180,11 +1180,13 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
1180
1180
if os_err == libc:: ENOSYS
1181
1181
|| os_err == libc:: EXDEV
1182
1182
|| os_err == libc:: EINVAL
1183
- || os_err == libc:: EPERM =>
1183
+ || os_err == libc:: EPERM
1184
+ || os_err == libc:: EOPNOTSUPP =>
1184
1185
{
1185
1186
// Try fallback io::copy if either:
1186
1187
// - Kernel version is < 4.5 (ENOSYS)
1187
1188
// - Files are mounted on different fs (EXDEV)
1189
+ // - copy_file_range is broken in various ways on RHEL/CentOS 7 (EOPNOTSUPP)
1188
1190
// - copy_file_range is disallowed, for example by seccomp (EPERM)
1189
1191
// - copy_file_range cannot be used with pipes or device nodes (EINVAL)
1190
1192
assert_eq ! ( written, 0 ) ;
You can’t perform that action at this time.
0 commit comments