libfstools: mtd: improve error handling
authorDaniel Golle <daniel@makrotopia.org>
Tue, 12 Apr 2022 21:51:04 +0000 (22:51 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 1 May 2022 15:55:49 +0000 (16:55 +0100)
commitce5eacb0762bb19c61a543b64167f7b27f189bed
tree7db17a2e71c93e74fba2d16cbb0c791180c48164
parent922f1b3c091dbe12af4ba12a76ba8563418b688c
libfstools: mtd: improve error handling

Use -1 to mark invalid file descriptors as 0 can theoretically be a
valid open file descriptor.
Do not ignore lseek() return value and check if an error has occured.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
libfstools/mtd.c