From 83decad32582dbf57cb51e27e0b3d6b94196cfeb Mon Sep 17 00:00:00 2001 From: Michal Hrusecky Date: Thu, 25 Oct 2018 12:53:02 +0200 Subject: [PATCH] mtd: Fail when verify fails Return non-zero exit code when mtd verify fails. Signed-off-by: Michal Hrusecky --- package/system/mtd/Makefile | 2 +- package/system/mtd/src/mtd.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/system/mtd/Makefile b/package/system/mtd/Makefile index 65de47f23f..c307555436 100644 --- a/package/system/mtd/Makefile +++ b/package/system/mtd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mtd -PKG_RELEASE:=23 +PKG_RELEASE:=24 PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME) STAMP_PREPARED := $(STAMP_PREPARED)_$(call confvar,CONFIG_MTD_REDBOOT_PARTS) diff --git a/package/system/mtd/src/mtd.c b/package/system/mtd/src/mtd.c index fa04c0f95b..b378dce359 100644 --- a/package/system/mtd/src/mtd.c +++ b/package/system/mtd/src/mtd.c @@ -799,7 +799,7 @@ static void do_reboot(void) int main (int argc, char **argv) { - int ch, i, boot, imagefd = 0, force, unlocked; + int ch, i, boot, imagefd = 0, force, unlocked, ret = 0; char *erase[MAX_ARGS], *device = NULL; char *fis_layout = NULL; size_t offset = 0, data_size = 0, part_offset = 0, dump_len = 0; @@ -994,7 +994,7 @@ int main (int argc, char **argv) mtd_unlock(device); break; case CMD_VERIFY: - mtd_verify(device, imagefile); + ret |= mtd_verify(device, imagefile); break; case CMD_DUMP: mtd_dump(device, offset, dump_len); @@ -1043,5 +1043,5 @@ int main (int argc, char **argv) if (boot) do_reboot(); - return 0; + return ret; } -- 2.30.2