do .h file content checks in binary mode, fixes #3544

we can't know the encoding header file authors will use,
so using binary for our simple checks is the safest way.
This commit is contained in:
Thomas Waldmann 2018-01-27 19:49:42 +01:00 committed by Mike Walters
parent d923e9146c
commit 912f96bed8
1 changed files with 4 additions and 4 deletions

View File

@ -101,8 +101,8 @@ def detect_openssl(prefixes):
for prefix in prefixes:
filename = os.path.join(prefix, 'include', 'openssl', 'evp.h')
if os.path.exists(filename):
with open(filename, 'r') as fd:
if 'PKCS5_PBKDF2_HMAC(' in fd.read():
with open(filename, 'rb') as fd:
if b'PKCS5_PBKDF2_HMAC(' in fd.read():
return prefix
@ -110,8 +110,8 @@ def detect_lz4(prefixes):
for prefix in prefixes:
filename = os.path.join(prefix, 'include', 'lz4.h')
if os.path.exists(filename):
with open(filename, 'r') as fd:
if 'LZ4_decompress_safe' in fd.read():
with open(filename, 'rb') as fd:
if b'LZ4_decompress_safe' in fd.read():
return prefix