system: sysupgrade: rework firmware validation
authorPetr Štetiar <ynezz@true.cz>
Mon, 30 Dec 2019 21:34:50 +0000 (22:34 +0100)
committerPetr Štetiar <ynezz@true.cz>
Sun, 5 Jan 2020 10:45:25 +0000 (11:45 +0100)
commitc7a2db3c1eb66080a1520a5748493cc0b55fac93
tree92dc905e27b5e1a561f9e871b15ef6f491688591
parentea45c4a0f07c699aec073f72daa5029438fab2c6
system: sysupgrade: rework firmware validation

Fixes following deficiencies:

 * unhandled read() errors
 * everything bundled in one long function, which is hard to follow and
   reason about
 * JSON parser errors are being ignored, anything else then
   json_tokener_continue is fatal error
 * JSON parser errors are being output to stderr, thus invisible via SSH
 * validate_firmware_image_call can fail at a lot of places, but we just
   get one generic "Firmware image couldn't be validated" so it's hard
   to debug

Cc: Rafał Miłecki <rafal@milecki.pl>
Tested-by: Kuan-Yi Li <kyli@abysm.org>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
system.c