Browse Source

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.
tags/n0.8
Stefano Sabatini 15 years ago
parent
commit
584c2f1db8
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      cmdutils.c

+ 2
- 0
cmdutils.c View File

@@ -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);


Loading…
Cancel
Save