patch referenced before assignment

This commit is contained in:
UltrafunkAmsterdam 2023-02-10 19:19:10 +01:00
parent 7c6ab42d7b
commit ca5fe635b9
1 changed files with 10 additions and 10 deletions

View File

@ -225,16 +225,16 @@ class Patcher(object):
len(target_bytes), b" " len(target_bytes), b" "
) )
) )
new_content = content.replace(target_bytes, new_target_bytes) new_content = content.replace(target_bytes, new_target_bytes)
if new_content == content: if new_content == content:
logger.warning( logger.warning(
"something went wrong patching the driver binary. could not find injection code block" "something went wrong patching the driver binary. could not find injection code block"
) )
else: else:
logger.debug( logger.debug(
"found block:\n%s\nreplacing with:\n%s" "found block:\n%s\nreplacing with:\n%s"
% (target_bytes, new_target_bytes) % (target_bytes, new_target_bytes)
) )
fh.seek(0) fh.seek(0)
fh.write(new_content) fh.write(new_content)
logger.debug( logger.debug(