]> Git Repo - qemu.git/commitdiff
image-fuzzer: Open image files in binary mode
authorEduardo Habkost <[email protected]>
Wed, 16 Oct 2019 19:24:21 +0000 (16:24 -0300)
committerStefan Hajnoczi <[email protected]>
Tue, 5 Nov 2019 15:35:06 +0000 (16:35 +0100)
This probably never caused problems because on Linux there's no
actual newline conversion happening, but on Python 3 the
binary/text distinction is stronger and we must explicitly open
the image file in binary mode.

Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: John Snow <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20191016192430[email protected]
Message-Id: <20191016192430[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
tests/image-fuzzer/qcow2/layout.py

index 675877da96194ad5172aa13f146db2a955060f3a..c57418fa15f12316612482c4dc62bb30e1b3fc3d 100644 (file)
@@ -503,7 +503,7 @@ class Image(object):
 
     def write(self, filename):
         """Write an entire image to the file."""
-        image_file = open(filename, 'w')
+        image_file = open(filename, 'wb')
         for field in self:
             image_file.seek(field.offset)
             image_file.write(struct.pack(field.fmt, field.value))
This page took 0.025749 seconds and 4 git commands to generate.