summaryrefslogtreecommitdiff
path: root/cmdutils.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-04-16 13:41:53 +0200
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2011-04-16 21:47:06 +0200
commit584c2f1db82fbb8024ba2b6b4c48397efedcc125 (patch)
treef18329b7f2a705ce5aa5e7230bc8c5c67f1d53d7 /cmdutils.c
parent3c10843f15badfb300b32e77cb476a851641a0be (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.
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 aa30962094..ff1b6aaeda 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -106,6 +106,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);