summaryrefslogtreecommitdiffstats
path: root/commands/ubiformat.c
diff options
context:
space:
mode:
Diffstat (limited to 'commands/ubiformat.c')
-rw-r--r--commands/ubiformat.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/commands/ubiformat.c b/commands/ubiformat.c
index 121816f4d7..5b4e5723f9 100644
--- a/commands/ubiformat.c
+++ b/commands/ubiformat.c
@@ -325,6 +325,11 @@ static int flash_image(const struct mtd_dev_info *mtd,
goto out_close;
}
+ if (st_size == 0) {
+ sys_errmsg("file \"%s\" has size 0 bytes", args.image);
+ goto out_close;
+ }
+
verbose(args.verbose, "will write %d eraseblocks", img_ebs);
divisor = img_ebs;
for (eb = 0; eb < mtd->eb_cnt; eb++) {