[oe-commits] [openembedded-core] 41/50: filemap: calculate dst size correctly
git at git.openembedded.org
git at git.openembedded.org
Sun Jun 11 22:08:06 UTC 2017
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit eec2f370c4a745d234f4de68aacb66731f70a321
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Thu Jun 8 19:12:58 2017 +0300
filemap: calculate dst size correctly
Fixed calculation of the dst file size using skip, seek and
length parameters. Current code does it incorrectly which
causes sparse_copy API to create unnecessary big output files.
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
scripts/lib/wic/filemap.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 764dbbe..6d11355 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,
dst_file = open(dst_fname, 'r+b')
except IOError:
dst_file = open(dst_fname, 'wb')
- dst_file.truncate(os.path.getsize(src_fname))
+ if length:
+ dst_size = length + seek
+ else:
+ dst_size = os.path.getsize(src_fname) + seek - skip
+ dst_file.truncate(dst_size)
written = 0
for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt):
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list