bmap: fix the image file open mode
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Thu, 18 Oct 2012 15:31:29 +0000 (18:31 +0300)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Thu, 18 Oct 2012 15:47:57 +0000 (18:47 +0300)
Open the image file in R/O binary mode instead of the default
R/O mode.

Change-Id: Ibc8b69fdf0b920c716e7cc9c23017747206e5500
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
mic/imager/raw.py

index d543cb2..1cce552 100644 (file)
@@ -621,7 +621,7 @@ class RawImageCreator(BaseImageCreator):
 
             image_size = os.path.getsize(image)
 
-            with open(bmap_file, "w") as f_bmap, open(image) as f_image:
+            with open(bmap_file, "w") as f_bmap, open(image, "rb") as f_image:
                 # Get the block size of the host file-system for the image file
                 # by calling the FIGETBSZ ioctl (number 2).
                 block_size = unpack('I', ioctl(f_image, 2, pack('I', 0)))[0]