diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-06-13 14:21:50 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-14 10:18:19 +0100 |
commit | c19f78a0713c8ac9d28b78f86c6d7b96157788f0 (patch) | |
tree | 6475369dc63d77297843a07178c35345bc27ec24 /scripts/lib | |
parent | 868cb638c92f650a2f0bea9669b68c1e8aebabab (diff) | |
download | openembedded-core-c19f78a0713c8ac9d28b78f86c6d7b96157788f0.tar.gz openembedded-core-c19f78a0713c8ac9d28b78f86c6d7b96157788f0.tar.bz2 openembedded-core-c19f78a0713c8ac9d28b78f86c6d7b96157788f0.zip |
filemap: fix skip logic
Fixed bug in processing 'skip' parameter:
don't read input file if end of bmap block is less than skip
Simplified logic of positioning to the start of data inside a
partially skipped bmap block.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/wic/filemap.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py index 1f1aacc522..585b7ea84e 100644 --- a/scripts/lib/wic/filemap.py +++ b/scripts/lib/wic/filemap.py @@ -545,11 +545,14 @@ def sparse_copy(src_fname, dst_fname, offset=0, skip=0, api=None): start = first * fmap.block_size end = (last + 1) * fmap.block_size + if skip >= end: + continue + if start < skip < end: - fmap._f_image.seek(skip, os.SEEK_SET) - else: - fmap._f_image.seek(start, os.SEEK_SET) - dst_file.seek(offset + start, os.SEEK_SET) + start = skip + + fmap._f_image.seek(start, os.SEEK_SET) + dst_file.seek(offset + start - skip, os.SEEK_SET) chunk_size = 1024 * 1024 to_read = end - start |