summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/filemap.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/filemap.py')
-rw-r--r--scripts/lib/wic/filemap.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 77e32b9add..a72fa09ef5 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -37,7 +37,15 @@ def get_block_size(file_obj):
37 # Get the block size of the host file-system for the image file by calling 37 # Get the block size of the host file-system for the image file by calling
38 # the FIGETBSZ ioctl (number 2). 38 # the FIGETBSZ ioctl (number 2).
39 binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0)) 39 binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0))
40 return struct.unpack('I', binary_data)[0] 40 bsize = struct.unpack('I', binary_data)[0]
41 if not bsize:
42 import os
43 stat = os.fstat(file_obj.fileno())
44 if hasattr(stat, 'st_blksize'):
45 bsize = stat.st_blksize
46 else:
47 raise IOError("Unable to determine block size")
48 return bsize
41 49
42class ErrorNotSupp(Exception): 50class ErrorNotSupp(Exception):
43 """ 51 """