summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sprintf.c b/sprintf.c
index acfbf64d54..9f4d8e404c 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -771,11 +771,12 @@ rb_f_sprintf(argc, argv)
}
sprint_exit:
- /* XXX - We cannot validiate the number of arguments because
- * the format string may contain `n$'-style argument selector.
+ /* XXX - We cannot validiate the number of arguments if (digit)$ style used.
*/
- if (RTEST(ruby_debug) && posarg >= 0 && nextarg < argc) {
- rb_raise(rb_eArgError, "too many arguments for format string");
+ if (posarg >= 0 && nextarg < argc) {
+ const char *mesg = "too many arguments for format string";
+ if (RTEST(ruby_debug)) rb_raise(rb_eArgError, mesg);
+ if (RTEST(ruby_verbose)) rb_warn(mesg);
}
rb_str_resize(result, blen);