From 071b825b23911a69dd1cd2f8cda004ef8a781fae Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Thu, 21 May 2009 17:22:01 +0300 Subject: Support special value "max" where xz and xzdec accept an integer. Don't round the memory usage limit in xzdec --help to avoid an integer overflow and to not give wrong impression that the limit is high enough when it may not actually be. --- src/xz/util.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/xz') diff --git a/src/xz/util.c b/src/xz/util.c index 9843c044..d200bfca 100644 --- a/src/xz/util.c +++ b/src/xz/util.c @@ -45,6 +45,10 @@ str_to_uint64(const char *name, const char *value, uint64_t min, uint64_t max) while (*value == ' ' || *value == '\t') ++value; + // Accept special value "max". Supporting "min" doesn't seem useful. + if (strcmp(value, "max") == 0) + return max; + if (*value < '0' || *value > '9') message_fatal(_("%s: Value is not a non-negative " "decimal integer"), value); -- cgit v1.2.3