diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-14 19:36:06 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-14 19:36:06 +0000 |
commit | 7201291187cdeb0e842280a3d77e41094993d0b7 (patch) | |
tree | c91e52d013ad7c22d3eb2f8327f0cef02bda42d2 /io.c | |
parent | 0e84de2b9830e3b752ba5f8d97aa3c38924aafc5 (diff) |
merge revision(s) 35296: [Backport #6295]
* io.c (rb_io_eof): use eof() instead of io_fillbuf(). It's because
io_unread() doesn't work properly when reading CRLF with read(length)
and mode 'r'.
[ruby-core:44189][Bug #6271]
* test/ruby/test_io_m17n.rb (TestIO_M17N#test_read_crlf_and_eof):
test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1444,6 +1444,11 @@ rb_io_eof(VALUE io) if (READ_CHAR_PENDING(fptr)) return Qfalse; if (READ_DATA_PENDING(fptr)) return Qfalse; READ_CHECK(fptr); +#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32) + if (!NEED_READCONV(fptr) && NEED_NEWLINE_DECORATOR_ON_READ(fptr)) { + return eof(fptr->fd) ? Qtrue : Qfalse; + } +#endif if (io_fillbuf(fptr) < 0) { return Qtrue; } |