From: Artem Bityutskiy Date: Wed, 23 Apr 2008 15:13:04 +0000 (+0300) Subject: ubi-utils: make sure only one volume is auto-resize X-Git-Tag: v1.2.0~27 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c31c4862453dc0193bf2083d1a4435283ae455a0;p=mtd-utils.git ubi-utils: make sure only one volume is auto-resize Signed-off-by: Artem Bityutskiy --- diff --git a/ubi-utils/new-utils/src/ubinize.c b/ubi-utils/new-utils/src/ubinize.c index 8ba8869..1350d41 100644 --- a/ubi-utils/new-utils/src/ubinize.c +++ b/ubi-utils/new-utils/src/ubinize.c @@ -418,7 +418,7 @@ static void init_vol_info(const struct ubigen_info *ui, int main(int argc, char * const argv[]) { - int err = -1, sects, i, volumes; + int err = -1, sects, i, volumes, autoresize_was_already = 0; struct ubigen_info ui; struct ubi_vtbl_record *vtbl; off_t seek; @@ -502,6 +502,14 @@ int main(int argc, char * const argv[]) verbose(args.verbose, "adding volume %d", vi.id); + /* Make sure only one volume has auto-resize flag */ + if (vi.flags & UBI_VTBL_AUTORESIZE_FLG) { + if (autoresize_was_already) + return errmsg("only one volume is allowed " + "to have auto-resize flag"); + autoresize_was_already = 1; + } + err = ubigen_add_volume(&ui, &vi, vtbl); if (err) { errmsg("cannot add volume for section \"%s\"", sname);