summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/wic/filemap.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index a3919fbcad..c53147c2f1 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -34,9 +34,11 @@ def get_block_size(file_obj):
34 # the FIGETBSZ ioctl (number 2). 34 # the FIGETBSZ ioctl (number 2).
35 try: 35 try:
36 binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0)) 36 binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0))
37 bsize = struct.unpack('I', binary_data)[0]
37 except OSError: 38 except OSError:
38 raise IOError("Unable to determine block size") 39 bsize = None
39 bsize = struct.unpack('I', binary_data)[0] 40
41 # If ioctl causes OSError or give bsize to zero failback to os.fstat
40 if not bsize: 42 if not bsize:
41 import os 43 import os
42 stat = os.fstat(file_obj.fileno()) 44 stat = os.fstat(file_obj.fileno())