Fix file_copy_sparse when file ends with hole

This commit is contained in:
Tom Marshall 2021-04-29 15:58:47 -07:00
parent 51f062b925
commit c8172f27b3
1 changed files with 7 additions and 1 deletions

8
vmmd
View File

@ -2210,7 +2210,13 @@ def acp_sparse(srcfile, dstfile, file_size):
off = 0
pct = 0
while off < file_size:
off = srcfile.seek(off, os.SEEK_DATA)
try:
off = srcfile.seek(off, os.SEEK_DATA)
except OSError as e:
if e.errno == errno.ENXIO:
dstfile.truncate(file_size)
return
raise
end = srcfile.seek(off, os.SEEK_HOLE)
srcfile.seek(off)
dstfile.seek(off)