|
@@ -270,6 +270,8 @@ static int get_value(struct parse_opt_ctx_t *p,
|
|
}
|
|
}
|
|
if (get_arg(p, opt, flags, &arg))
|
|
if (get_arg(p, opt, flags, &arg))
|
|
return -1;
|
|
return -1;
|
|
|
|
+ if (arg[0] == '-')
|
|
|
|
+ return opterror(opt, "expects an unsigned numerical value", flags);
|
|
*(unsigned int *)opt->value = strtol(arg, (char **)&s, 10);
|
|
*(unsigned int *)opt->value = strtol(arg, (char **)&s, 10);
|
|
if (*s)
|
|
if (*s)
|
|
return opterror(opt, "expects a numerical value", flags);
|
|
return opterror(opt, "expects a numerical value", flags);
|
|
@@ -302,6 +304,8 @@ static int get_value(struct parse_opt_ctx_t *p,
|
|
}
|
|
}
|
|
if (get_arg(p, opt, flags, &arg))
|
|
if (get_arg(p, opt, flags, &arg))
|
|
return -1;
|
|
return -1;
|
|
|
|
+ if (arg[0] == '-')
|
|
|
|
+ return opterror(opt, "expects an unsigned numerical value", flags);
|
|
*(u64 *)opt->value = strtoull(arg, (char **)&s, 10);
|
|
*(u64 *)opt->value = strtoull(arg, (char **)&s, 10);
|
|
if (*s)
|
|
if (*s)
|
|
return opterror(opt, "expects a numerical value", flags);
|
|
return opterror(opt, "expects a numerical value", flags);
|