free: remove redundant boundary check

The strtol_or_err() already check argument is not larger than
LONG_MAX. This commit also removes clang warning.

free.c:262:55: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
                        if (args.repeat_counter < 1 || args.repeat_counter > ULONG_MAX/2)
                                                       ~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2012-02-26 12:26:59 +01:00 committed by Craig Small
parent 90c0590b4c
commit a3544b00f8

2
free.c
View File

@ -259,7 +259,7 @@ int main(int argc, char **argv)
flags |= FREE_REPEATCOUNT;
args.repeat_counter = strtol_or_err(optarg,
_("failed to parse count argument"));
if (args.repeat_counter < 1 || args.repeat_counter > ULONG_MAX/2)
if (args.repeat_counter < 1)
error(EXIT_FAILURE, ERANGE,
_("failed to parse count argument: '%s'"), optarg);
break;