diff options
Diffstat (limited to 'ubi-utils/src/ubinfo.c')
-rw-r--r-- | ubi-utils/src/ubinfo.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ubi-utils/src/ubinfo.c b/ubi-utils/src/ubinfo.c index 3171e8a..2bfee16 100644 --- a/ubi-utils/src/ubinfo.c +++ b/ubi-utils/src/ubinfo.c @@ -89,8 +89,7 @@ static const struct option long_options[] = { static int parse_opt(int argc, char * const argv[]) { while (1) { - int key; - char *endp; + int key, error = 0; key = getopt_long(argc, argv, "an:N:d:hV", long_options, NULL); if (key == -1) @@ -102,8 +101,8 @@ static int parse_opt(int argc, char * const argv[]) break; case 'n': - args.vol_id = strtoul(optarg, &endp, 0); - if (*endp != '\0' || endp == optarg || args.vol_id < 0) + args.vol_id = simple_strtoul(optarg, &error); + if (error || args.vol_id < 0) return errmsg("bad volume ID: " "\"%s\"", optarg); break; @@ -112,8 +111,8 @@ static int parse_opt(int argc, char * const argv[]) break; case 'd': - args.devn = strtoul(optarg, &endp, 0); - if (*endp != '\0' || endp == optarg || args.devn < 0) + args.devn = simple_strtoul(optarg, &error); + if (error || args.devn < 0) return errmsg("bad UBI device number: \"%s\"", optarg); break; |