1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c (io_binwrite_string): Test writev() failure.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2014-10-25 13:34:21 +00:00
parent 96d375540f
commit 1fe90db538
3 changed files with 18 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Sat Oct 25 22:28:17 2014 Tanaka Akira <akr@fsij.org>
* io.c (io_binwrite_string): Test writev() failure.
Sat Oct 25 20:19:19 2014 Martin Duerst <duerst@it.aoyama.ac.jp> Sat Oct 25 20:19:19 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
* test/test-unicode_normalize.rb: added test_us_ascii. * test/test-unicode_normalize.rb: added test_us_ascii.

3
io.c
View file

@ -1276,6 +1276,9 @@ io_binwrite_string(VALUE arg)
r = rb_writev_internal(fptr->fd, iov, 2); r = rb_writev_internal(fptr->fd, iov, 2);
if (r == -1)
return -1;
if (fptr->wbuf.len <= r) { if (fptr->wbuf.len <= r) {
r -= fptr->wbuf.len; r -= fptr->wbuf.len;
fptr->wbuf.off = 0; fptr->wbuf.off = 0;

View file

@ -1370,6 +1370,17 @@ class TestIO < Test::Unit::TestCase
end end
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 def test_close_read_non_readable
with_pipe do |r, w| with_pipe do |r, w|
assert_raise(IOError) do assert_raise(IOError) do