diff options
Diffstat (limited to 'scripts/lib/wic/filemap.py')
-rw-r--r-- | scripts/lib/wic/filemap.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py index 764dbbe588..6d11355a18 100644 --- a/scripts/lib/wic/filemap.py +++ b/scripts/lib/wic/filemap.py | |||
@@ -549,7 +549,11 @@ def sparse_copy(src_fname, dst_fname, skip=0, seek=0, | |||
549 | dst_file = open(dst_fname, 'r+b') | 549 | dst_file = open(dst_fname, 'r+b') |
550 | except IOError: | 550 | except IOError: |
551 | dst_file = open(dst_fname, 'wb') | 551 | dst_file = open(dst_fname, 'wb') |
552 | dst_file.truncate(os.path.getsize(src_fname)) | 552 | if length: |
553 | dst_size = length + seek | ||
554 | else: | ||
555 | dst_size = os.path.getsize(src_fname) + seek - skip | ||
556 | dst_file.truncate(dst_size) | ||
553 | 557 | ||
554 | written = 0 | 558 | written = 0 |
555 | for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt): | 559 | for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt): |