diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-03-22 15:42:28 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-22 15:07:37 +0000 |
commit | 567186f995302a095a771baede4ff5034d1d1862 (patch) | |
tree | 09af33868e3c1eb7e7b6f56420de0065ff67997b | |
parent | 48a5d67d7cafdeac821e6f35bea380521ef017d5 (diff) | |
download | openembedded-core-567186f995302a095a771baede4ff5034d1d1862.tar.gz openembedded-core-567186f995302a095a771baede4ff5034d1d1862.tar.bz2 openembedded-core-567186f995302a095a771baede4ff5034d1d1862.zip |
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.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/wic/filemap.py | 1 |
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): dst_file = open(dst_fname, 'r+b') except IOError: dst_file = open(dst_fname, 'wb') + dst_file.truncate(os.path.getsize(src_fname)) for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt): start = first * fmap.block_size |