summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-03-22 15:42:28 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-23 13:19:49 +0000
commitb78c564cca7353ac86a432b03469dad190b46fa3 (patch)
treebcb13d7401cd450dcf8da560af103f8b8dc923d2 /scripts
parent627952a234a844783a6d4ee9aa3f1608a0d537d0 (diff)
downloadpoky-b78c564cca7353ac86a432b03469dad190b46fa3.tar.gz
wic: fix bug in sparse_copy
sparse_copy creates output file that is smaller than input file when input file ends with unmapped blocks. Used truncate(<input file size>) when output file is created to ensure the size of output file will always be equal to the size of input file. (From OE-Core rev: 567186f995302a095a771baede4ff5034d1d1862) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/filemap.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 162603ed0a..080668e7c2 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -537,6 +537,7 @@ def sparse_copy(src_fname, dst_fname, offset=0, skip=0):
537 dst_file = open(dst_fname, 'r+b') 537 dst_file = open(dst_fname, 'r+b')
538 except IOError: 538 except IOError:
539 dst_file = open(dst_fname, 'wb') 539 dst_file = open(dst_fname, 'wb')
540 dst_file.truncate(os.path.getsize(src_fname))
540 541
541 for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt): 542 for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt):
542 start = first * fmap.block_size 543 start = first * fmap.block_size