[oe-commits] [openembedded-core] 40/50: filemap: check if dest is written for every block

git at git.openembedded.org git at git.openembedded.org
Sun Jun 11 22:08:05 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 acb4a0563f4ee0dc89a19321d6149394df1f2625
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Thu Jun 8 19:12:57 2017 +0300

    filemap: check if dest is written for every block
    
    If lenght parameter is provided to sparse_copy call
    it's mandatory to check if the output file is fully
    written after reading unmapped block from input file.
    
    If it's not done then sparse_copy can write more data
    than specified length.
    
    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 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 8719f44..764dbbe 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -563,6 +563,13 @@ def sparse_copy(src_fname, dst_fname, skip=0, seek=0,
             start = skip
 
         fmap._f_image.seek(start, os.SEEK_SET)
+
+        written += start - skip - written
+        if length and written >= length:
+            dst_file.seek(seek + length, os.SEEK_SET)
+            dst_file.close()
+            return
+
         dst_file.seek(seek + start - skip, os.SEEK_SET)
 
         chunk_size = 1024 * 1024

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list