[oe-commits] [openembedded-core] 02/06: wic/filemap: handle FIGETBSZ failing

git at git.openembedded.org git at git.openembedded.org
Fri Jun 7 12:48:04 UTC 2019


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 70a7f58c2c991639229cbf8f254616b11fbec071
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Fri Jun 7 12:05:02 2019 +0100

    wic/filemap: handle FIGETBSZ failing
    
    Some file systems don't support fetching the block size (notably the file system
    Docker uses for containers), so handle the iotctl() failing and raise the
    expected error.
    
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/lib/wic/filemap.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 244c07a..a3919fb 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -32,7 +32,10 @@ def get_block_size(file_obj):
     """
     # Get the block size of the host file-system for the image file by calling
     # the FIGETBSZ ioctl (number 2).
-    binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0))
+    try:
+        binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0))
+    except OSError:
+        raise IOError("Unable to determine block size")
     bsize = struct.unpack('I', binary_data)[0]
     if not bsize:
         import os

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


More information about the Openembedded-commits mailing list