summaryrefslogtreecommitdiff
path: root/cmdutils.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-04-16 13:41:53 +0200
committerAnton Khirnov <anton@khirnov.net>2011-05-10 07:15:24 +0200
commit3372ec327b09abe492399d662c903ed77b359d45 (patch)
tree0ae5e44bd8e851f8d46411d6bba61abb160102fa /cmdutils.c
parent0420bf09f7d297210df03b4467cb3945ae627bf6 (diff)
cmdutils: add OPT_INT check in parse_number_or_die()
Check that the value passed for an OPT_INT option is an int, fail otherwise. Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'cmdutils.c')
-rw-r--r--cmdutils.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cmdutils.c b/cmdutils.c
index 59f0ce7fd1..f95778822e 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -107,6 +107,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
error= "The value for %s was %s which is not within %f - %f\n";
else if(type == OPT_INT64 && (int64_t)d != d)
error= "Expected int64 for %s but found %s\n";
+ else if (type == OPT_INT && (int)d != d)
+ error= "Expected int for %s but found %s\n";
else
return d;
fprintf(stderr, error, context, numstr, min, max);