ruby-changes:36055
From: akr <ko1@a...>
Date: Sat, 25 Oct 2014 22:34:35 +0900 (JST)
Subject: [ruby-changes:36055] akr:r48136 (trunk): * io.c (io_binwrite_string): Test writev() failure.
akr 2014-10-25 22:34:21 +0900 (Sat, 25 Oct 2014) New Revision: 48136 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48136 Log: * io.c (io_binwrite_string): Test writev() failure. Modified files: trunk/ChangeLog trunk/io.c trunk/test/ruby/test_io.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 48135) +++ ChangeLog (revision 48136) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Oct 25 22:28:17 2014 Tanaka Akira <akr@f...> + + * io.c (io_binwrite_string): Test writev() failure. + Sat Oct 25 20:19:19 2014 Martin Duerst <duerst@i...> * test/test-unicode_normalize.rb: added test_us_ascii. Index: io.c =================================================================== --- io.c (revision 48135) +++ io.c (revision 48136) @@ -1276,6 +1276,9 @@ io_binwrite_string(VALUE arg) https://github.com/ruby/ruby/blob/trunk/io.c#L1276 r = rb_writev_internal(fptr->fd, iov, 2); + if (r == -1) + return -1; + if (fptr->wbuf.len <= r) { r -= fptr->wbuf.len; fptr->wbuf.off = 0; Index: test/ruby/test_io.rb =================================================================== --- test/ruby/test_io.rb (revision 48135) +++ test/ruby/test_io.rb (revision 48136) @@ -1370,6 +1370,17 @@ class TestIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L1370 end end + def test_close_read_pipe_nosync + assert_separately([], <<-"end;") + r, w = IO.pipe + r.close + w.sync = false + assert_raise(Errno::EPIPE) { + loop { w.write "a" } + } + end; + end + def test_close_read_non_readable with_pipe do |r, w| assert_raise(IOError) do -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/