proton: Don't use copy_file_range if fs doesn't support it.

This commit is contained in:
Arkadiusz Hiler 2024-03-19 20:39:53 +02:00
parent bd8d7e374e
commit c17db0b838

4
proton
View File

@ -229,9 +229,9 @@ def copyfile_reflink(srcname, dstname):
while bytes_to_copy > 0: while bytes_to_copy > 0:
bytes_to_copy -= copy_file_range(src.fileno(), dst.fileno(), bytes_to_copy) bytes_to_copy -= copy_file_range(src.fileno(), dst.fileno(), bytes_to_copy)
except OSError as e: except OSError as e:
if e.errno not in (errno.EXDEV, errno.ENOSYS, errno.EINVAL): if e.errno not in (errno.EXDEV, errno.ENOSYS, errno.EINVAL, errno.EOPNOTSUPP):
raise e raise e
if e.errno == errno.ENOSYS: if e.errno == errno.ENOSYS or e.errno == errno.EOPNOTSUPP:
copyfile = shutil.copyfile copyfile = shutil.copyfile
shutil.copyfile(srcname, dstname) shutil.copyfile(srcname, dstname)