extract.py: exit on error

This commit is contained in:
Takumi Sueda 2021-03-04 14:49:51 +09:00
parent 6001ad21cf
commit 1559a0e69b

View File

@ -17,6 +17,7 @@ def extract(elf):
text = elf.get_section_by_name('.text') text = elf.get_section_by_name('.text')
if text is None: if text is None:
print('Input ELF has no .text section', file=sys.stderr) print('Input ELF has no .text section', file=sys.stderr)
sys.exit(1)
with open(sys.argv[2], 'wb') as f: with open(sys.argv[2], 'wb') as f:
elf.stream.seek(0) elf.stream.seek(0)