ruby-changes:38800
From: eregon <ko1@a...>
Date: Sun, 14 Jun 2015 05:25:32 +0900 (JST)
Subject: [ruby-changes:38800] eregon:r50881 (trunk): * io.c (rb_io_s_binread): close fd if seek offset is invalid.
eregon 2015-06-14 05:25:10 +0900 (Sun, 14 Jun 2015) New Revision: 50881 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50881 Log: * io.c (rb_io_s_binread): close fd if seek offset is invalid. Modified files: trunk/ChangeLog trunk/io.c Index: ChangeLog =================================================================== --- ChangeLog (revision 50880) +++ ChangeLog (revision 50881) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Jun 14 05:23:51 2015 Benoit Daloze <eregontp@g...> + + * io.c (rb_io_s_binread): close fd if seek offset is invalid. + Sun Jun 14 04:40:32 2015 Benoit Daloze <eregontp@g...> * test/lib/leakchecker.rb (check): refactor. Index: io.c =================================================================== --- io.c (revision 50880) +++ io.c (revision 50881) @@ -9901,7 +9901,16 @@ rb_io_s_binread(int argc, VALUE *argv, V https://github.com/ruby/ruby/blob/trunk/io.c#L9901 arg.argv = argv+1; arg.argc = (argc > 1) ? 1 : 0; if (!NIL_P(offset)) { - rb_io_seek(arg.io, offset, SEEK_SET); + struct seek_arg sarg; + int state = 0; + sarg.io = arg.io; + sarg.offset = offset; + sarg.mode = SEEK_SET; + rb_protect(seek_before_access, (VALUE)&sarg, &state); + if (state) { + rb_io_close(arg.io); + rb_jump_tag(state); + } } return rb_ensure(io_s_read, (VALUE)&arg, rb_io_close, arg.io); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/