diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-22 08:36:25 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-22 08:36:25 +0000 |
commit | 31d8a976575d38bd912b7e4aa5204fd88b5a97fc (patch) | |
tree | 623244c547597f05e0a3e17faa1546b9d4b6d3f2 /io.c | |
parent | 873b56fd50e12294601bbe96b1bef3b2c2428010 (diff) | |
download | ruby-31d8a976575d38bd912b7e4aa5204fd88b5a97fc.tar.gz |
* io.c (rb_io_s_foreach): argument check before making Enumerator.
[ruby-dev:31525]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -8969,10 +8969,11 @@ static VALUE rb_io_s_foreach(int argc, VALUE *argv, VALUE self) { VALUE opt; + int orig_argc = argc; struct foreach_arg arg; - RETURN_ENUMERATOR(self, argc, argv); argc = rb_scan_args(argc, argv, "13:", NULL, NULL, NULL, NULL, &opt); + RETURN_ENUMERATOR(self, orig_argc, argv); open_key_args(argc, argv, opt, &arg); if (NIL_P(arg.io)) return Qnil; return rb_ensure(io_s_foreach, (VALUE)&arg, rb_io_close, arg.io); |