From c31c4862453dc0193bf2083d1a4435283ae455a0 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Wed, 23 Apr 2008 18:13:04 +0300 Subject: ubi-utils: make sure only one volume is auto-resize Signed-off-by: Artem Bityutskiy --- ubi-utils/new-utils/src/ubinize.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ubi-utils/new-utils/src/ubinize.c') 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); -- cgit v1.2.3