summaryrefslogtreecommitdiff
path: root/ubi-utils/src/ubirsvol.c
diff options
context:
space:
mode:
Diffstat (limited to 'ubi-utils/src/ubirsvol.c')
-rw-r--r--ubi-utils/src/ubirsvol.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/ubi-utils/src/ubirsvol.c b/ubi-utils/src/ubirsvol.c
index 20a1d33..34321b8 100644
--- a/ubi-utils/src/ubirsvol.c
+++ b/ubi-utils/src/ubirsvol.c
@@ -107,8 +107,7 @@ static int param_sanity_check(void)
static int parse_opt(int argc, char * const argv[])
{
while (1) {
- int key;
- char *endp;
+ int key, error = 0;
key = getopt_long(argc, argv, "s:S:n:N:h?V", long_options, NULL);
if (key == -1)
@@ -122,14 +121,14 @@ static int parse_opt(int argc, char * const argv[])
break;
case 'S':
- args.lebs = strtoull(optarg, &endp, 0);
- if (endp == optarg || args.lebs <= 0 || *endp != '\0')
+ args.lebs = simple_strtoull(optarg, &error);
+ if (error || args.lebs <= 0)
return errmsg("bad LEB count: \"%s\"", optarg);
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) {
errmsg("bad volume ID: " "\"%s\"", optarg);
return -1;
}