proton: Fix byte string comparison

This commit is contained in:
Andrew Eikum 2018-08-24 13:48:57 -05:00
parent 9428857077
commit e7c4d12f8d

4
proton
View File

@ -342,7 +342,7 @@ def determine_architecture(path):
try: try:
with open(path, "rb") as f: with open(path, "rb") as f:
magic = f.read(2) magic = f.read(2)
if magic != "MZ": if magic != b"MZ":
return ARCH_UNKNOWN return ARCH_UNKNOWN
f.seek(0x18) f.seek(0x18)
reloc = struct.unpack('<H', f.read(2))[0] reloc = struct.unpack('<H', f.read(2))[0]
@ -353,7 +353,7 @@ def determine_architecture(path):
pe_offs = struct.unpack('<L', f.read(4))[0] pe_offs = struct.unpack('<L', f.read(4))[0]
f.seek(pe_offs) f.seek(pe_offs)
magic = f.read(4) magic = f.read(4)
if magic != "PE\0\0": if magic != b"PE\0\0":
return ARCH_UNKNOWN return ARCH_UNKNOWN
f.seek(pe_offs + 4) f.seek(pe_offs + 4)
arch = struct.unpack('<H', f.read(2))[0] arch = struct.unpack('<H', f.read(2))[0]