Commit 0801cfee authored by Walter Dörwald's avatar Walter Dörwald

Fix libc_ver(): libc_ver() was reading sys.executable

in binary mode and comparing the content to strings,
which failed. Now the bytes get decoded into unicode
using latin-1 (the comparison compares ASCII strings
only anyway, and we don't want the decoding to fail).
parent fd093a45
...@@ -145,12 +145,12 @@ def libc_ver(executable=sys.executable,lib='',version='', ...@@ -145,12 +145,12 @@ def libc_ver(executable=sys.executable,lib='',version='',
# able to open symlinks for reading # able to open symlinks for reading
executable = os.path.realpath(executable) executable = os.path.realpath(executable)
f = open(executable,'rb') f = open(executable,'rb')
binary = f.read(chunksize) binary = f.read(chunksize).decode('latin-1')
pos = 0 pos = 0
while 1: while 1:
m = _libc_search.search(binary,pos) m = _libc_search.search(binary,pos)
if not m: if not m:
binary = f.read(chunksize) binary = f.read(chunksize).decode('latin-1')
if not binary: if not binary:
break break
pos = 0 pos = 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment