mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 07:11:13 +02:00
Merge branch 'master' into 2.0
This commit is contained in:
14 files changed
+314
-30
No files matched your search
@@ -61,7 +61,11 @@ class Qcow2:
|
||||
struct_format = ">IIQi"
|
||||
with open(self._path, 'rb') as f:
|
||||
content = f.read(struct.calcsize(struct_format))
|
||||
self.magic, self.version, self.backing_file_offset, self.backing_file_size = struct.unpack_from(struct_format, content)
|
||||
try:
|
||||
self.magic, self.version, self.backing_file_offset, self.backing_file_size = struct.unpack_from(struct_format, content)
|
||||
|
||||
except struct.error:
|
||||
raise Qcow2Error("Invalid file header for {}".format(self._path))
|
||||
|
||||
if self.magic != 1363560955: # The first 4 bytes contain the characters 'Q', 'F', 'I' followed by 0xfb.
|
||||
raise Qcow2Error("Invalid magic for {}".format(self._path))
|
||||
|
||||
Reference in new issue
Block a user