summaryrefslogtreecommitdiff
path: root/ubi-utils/src/ubirsvol.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-04-08 17:58:55 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-04-09 17:49:22 +0300
commit924862c864da0b62cf93ba7abf2dc78a7e6ac48f (patch)
tree4d47039b5a095966b2551ffd9dfd0400fdbaeb55 /ubi-utils/src/ubirsvol.c
parentdd2a035dd6cb7408a99fac2052b6812e7f489de8 (diff)
mtd-utils: switch ubi and ubifs tools to use common strtoX funcs
Instead of using strtol and Co directly, use our share simple_strtoX() helpers. This is just a cleanup. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
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;
}