diff options
author | Ross Burton <ross.burton@intel.com> | 2019-06-07 12:05:02 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-06-08 16:01:41 +0100 |
commit | ca4cdfcd18b4d48e22c9b4ae0af0a4ed8991a6f1 (patch) | |
tree | c6765931afdf80f44853e2e9f763013c0a3181ee /scripts | |
parent | bbe3bf4bfeaf6c16b5ab13d43aa998f3e894ce59 (diff) | |
download | poky-ca4cdfcd18b4d48e22c9b4ae0af0a4ed8991a6f1.tar.gz |
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.
(From OE-Core rev: 3757073726a00c5250556aae3d0daac76b88085e)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/wic/filemap.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py index 244c07a71c..a3919fbcad 100644 --- a/scripts/lib/wic/filemap.py +++ b/scripts/lib/wic/filemap.py | |||
@@ -32,7 +32,10 @@ def get_block_size(file_obj): | |||
32 | """ | 32 | """ |
33 | # Get the block size of the host file-system for the image file by calling | 33 | # Get the block size of the host file-system for the image file by calling |
34 | # the FIGETBSZ ioctl (number 2). | 34 | # the FIGETBSZ ioctl (number 2). |
35 | binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0)) | 35 | try: |
36 | binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0)) | ||
37 | except OSError: | ||
38 | raise IOError("Unable to determine block size") | ||
36 | bsize = struct.unpack('I', binary_data)[0] | 39 | bsize = struct.unpack('I', binary_data)[0] |
37 | if not bsize: | 40 | if not bsize: |
38 | import os | 41 | import os |