summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authorTom Stuart <hi@tomstu.art>2023-07-01 15:19:01 +0100
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-07-16 00:39:01 +0900
commitde68e240c7a1ded3049ee23d8bf2db5a15f4f39b (patch)
treeb09f543c4e58b48fc8f49224473d01e7fa572a3d /ruby.c
parent125b4461dfa0a908c7fc6cd6964b080f89c88a47 (diff)
Allow -1 as the value of `--backtrace-limit` option
-1 is a legitimate backtrace limit — in fact, it’s the default — so it should be possible to provide it with the `--backtrace-limit` option.
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ruby.c b/ruby.c
index 92ea37b4f6..30e0e68360 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1449,7 +1449,7 @@ proc_long_options(ruby_cmdline_options_t *opt, const char *s, long argc, char **
else if (is_option_with_arg("backtrace-limit", Qfalse, Qtrue)) {
char *e;
long n = strtol(s, &e, 10);
- if (errno == ERANGE || n < 0 || *e) rb_raise(rb_eRuntimeError, "wrong limit for backtrace length");
+ if (errno == ERANGE || n < -1 || *e) rb_raise(rb_eRuntimeError, "wrong limit for backtrace length");
opt->backtrace_length_limit = (int)n;
}
else {