]> www.infradead.org Git - mtd-utils.git/commitdiff
ubinize: fix 64-bit image sequence number confusion
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 24 Aug 2009 12:41:21 +0000 (15:41 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 24 Aug 2009 12:43:36 +0000 (15:43 +0300)
UBI image sequence number which we store in EC headers is 32 bits,
not 64-bits. I was confused when noticed that the 'image_seq'
variable had type 'unsigned long long'. Turn it into a 'uint32_t'
type.

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

index 2d86c03152b0da77e04b70c19244bda5434ad944..dd8d3ed867e0b291d31fd2168e41c312437463e7 100644 (file)
@@ -70,7 +70,7 @@ static const char *optionsstr =
 "                             (default is 0)\n"
 "-x, --ubi-ver=<num>          UBI version number to put to EC headers\n"
 "                             (default is 1)\n"
-"-Q, --image-seq=<num>        64-bit UBI image sequence number to use\n"
+"-Q, --image-seq=<num>        32-bit UBI image sequence number to use\n"
 "                             (by default a random number is picked)\n"
 "-v, --verbose                be verbose\n"
 "-h, --help                   print help message\n"
@@ -143,7 +143,7 @@ struct args {
        int vid_hdr_offs;
        int ec;
        int ubi_ver;
-       long long image_seq;
+       uint32_t image_seq;
        int verbose;
        dictionary *dict;
 };
@@ -161,6 +161,7 @@ static int parse_opt(int argc, char * const argv[])
        while (1) {
                int key;
                char *endp;
+               unsigned long long image_seq;
 
                key = getopt_long(argc, argv, "o:p:m:s:O:e:x:Q:vhV", long_options, NULL);
                if (key == -1)
@@ -216,9 +217,10 @@ static int parse_opt(int argc, char * const argv[])
                        break;
 
                case 'Q':
-                       args.image_seq = strtoul(optarg, &endp, 0);
-                       if (*endp != '\0'  || endp == optarg || args.image_seq > 0xFFFFFFFF)
+                       image_seq = strtoul(optarg, &endp, 0);
+                       if (*endp != '\0'  || endp == optarg || image_seq > 0xFFFFFFFF)
                                return errmsg("bad UBI image sequence number: \"%s\"", optarg);
+                       args.image_seq = image_seq;
                        break;
 
                case 'v':