diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-23 10:43:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-23 10:43:04 +0000 |
commit | 163a6e81b207525e4f35e21464ee5ab3afbd3cb5 (patch) | |
tree | 092e4838bf4d94d7c99780b984c1d734c533eaab /io.c | |
parent | 44182056f63e877e90f75abcd12df9695311180c (diff) |
* io.c (rb_io_ungetc): raise an exception at unread stream to
avoid unspecified behavior. [ruby-dev:22330]
* test/ruby/test_system.rb (test_syntax): glob relatively from
__FILE__.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1314,8 +1314,9 @@ rb_io_ungetc(io, c) int cc = NUM2INT(c); GetOpenFile(io, fptr); + if (!(fptr->mode & FMODE_RBUF)) + rb_raise(rb_eIOError, "unread stream"); rb_io_check_readable(fptr); - flush_before_seek(fptr); if (ungetc(cc, fptr->f) == EOF && cc != EOF) rb_sys_fail(fptr->path); @@ -3456,7 +3457,7 @@ rb_io_ctl(io, req, arg, io_p) rb_raise(rb_eArgError, "return value overflowed string"); } - if (fptr->f2 && fileno(fptr->f) != fileno(fptr->f2)) { + if (fptr->f2 && fileno(fptr->f) != fileno(fptr->f2)) { /* call on f2 too; ignore result */ io_cntl(fileno(fptr->f2), cmd, narg, io_p); } |