X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fruntime.c;h=f66a7e562b67bc3c8a33265f3034a498d6d96011;hb=0285aa5ff8416027932daa001b84429be2ca559b;hp=d2cb7323b5625ecbd5e8ad0fc2c305f655635497;hpb=798b02eeb8691ec00138f03dac3858368a8b0b0b;p=sbcl.git diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c index d2cb732..f66a7e5 100644 --- a/src/runtime/runtime.c +++ b/src/runtime/runtime.c @@ -292,11 +292,13 @@ search_for_executable(const char *argv0) } #endif /* LISP_FEATURE_WIN32 */ -long parse_size_arg(char *arg, char *arg_name) +unsigned long parse_size_arg(char *arg, char *arg_name) { char *tail, *power_name; - long power, res; - res = strtol(arg, &tail, 0); + unsigned long power, res; + + res = strtoul(arg, &tail, 0); + if (arg == tail) { lose("%s argument is not a number: %s", arg_name, arg); } else if (tail[0]) { @@ -325,7 +327,7 @@ long parse_size_arg(char *arg, char *arg_name) free(power_name); } if ((res <= 0) || - (res >= (LONG_MAX >> power))) { + (res > (ULONG_MAX >> power))) { lose("%s argument is out of range: %s", arg_name, arg); } res <<= power; @@ -449,7 +451,7 @@ main(int argc, char *argv[], char *envp[]) DYNAMIC_SPACE_START+dynamic_space_size) && (DYNAMIC_SPACE_START+dynamic_space_size <= MAX_DYNAMIC_SPACE_END))) - lose("--dynamic-space-size argument %s is too large, max %ldMiB", + lose("--dynamic-space-size argument %s is too large, max %lu", argv[argi-1], MAX_DYNAMIC_SPACE_END-DYNAMIC_SPACE_START); # endif } else if (0 == strcmp(arg, "--control-stack-size")) {