check_boot_flag(): Open device in binary mode
authorSven Joachim <svenjoac@gmx.de>
Wed, 30 Oct 2019 16:35:03 +0000 (17:35 +0100)
committerSven Joachim <svenjoac@gmx.de>
Wed, 30 Oct 2019 16:35:03 +0000 (17:35 +0100)
commitc2e742a6dc8a594f71fb7cf0b3233f31f48935de
tree5cf760366cda41028bcd79affcb4add122e0a8ea
parent5b2ffe433479368d711a63d985b926966940cad5
check_boot_flag(): Open device in binary mode

By default open() reads in text which is not going to fly for a boot
sector.

Fatal: 'utf-8' codec can't decode byte 0x90 in position 6: invalid start byte
Exception:
Traceback (most recent call last):
  File "/usr/sbin/grml2usb", line 1913, in main
    install(iso, device)
  File "/usr/sbin/grml2usb", line 1626, in install
    install_grml(iso_mountpoint, device)
  File "/usr/sbin/grml2usb", line 1653, in install_grml
    check_boot_flag(device)
  File "/usr/sbin/grml2usb", line 393, in check_boot_flag
    data = image.read(520)
  File "/usr/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 6: invalid start byte
grml2usb