From ca4cdfcd18b4d48e22c9b4ae0af0a4ed8991a6f1 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Fri, 7 Jun 2019 12:05:02 +0100 Subject: 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 Signed-off-by: Richard Purdie --- scripts/lib/wic/filemap.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scripts/lib') 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): """ # 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 -- cgit v1.2.3-54-g00ecf