]> www.infradead.org Git - mtd-utils.git/commitdiff
ubiformat: allow zero erase counter
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 30 Jun 2009 10:03:45 +0000 (13:03 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 30 Jun 2009 11:55:56 +0000 (14:55 +0300)
This patch fixes the following issue:

$ ubiformat /dev/mtd2 -e 0
ubiformat: error!: bad erase counter value: "0"

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
ubi-utils/src/ubiformat.c

index a3df28145f18eb0c66f1f15f9445c2b3cf322da5..2a62f3b91dbac5ecde5f3550fed9b2399c0f32dc 100644 (file)
@@ -154,7 +154,7 @@ static int parse_opt(int argc, char * const argv[])
 
                case 'e':
                        args.ec = strtoull(optarg, &endp, 0);
-                       if (args.ec <= 0 || *endp != '\0' || endp == optarg)
+                       if (args.ec < 0 || *endp != '\0' || endp == optarg)
                                return errmsg("bad erase counter value: \"%s\"", optarg);
                        if (args.ec >= EC_MAX)
                                return errmsg("too high erase %llu, counter, max is %u", args.ec, EC_MAX);