summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-21 06:31:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-21 06:31:03 +0000
commit237c54075a575ab683584e451423098c039e5dba (patch)
tree0f3c64cdac086f33d6990174e330634c9cdca15f /io.c
parentc5dea4c69d0cd357f277a9607319802ef34fec8a (diff)
* io.c (rb_io_ungetbyte, rb_io_ungetc): clears EOF flag.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/io.c b/io.c
index 16f37cda39..ee8bf7cb93 100644
--- a/io.c
+++ b/io.c
@@ -354,7 +354,8 @@ flush_before_seek(rb_io_t *fptr)
}
#define io_set_eof(fptr) (void)(((fptr)->mode & FMODE_TTY) && ((fptr)->mode |= FMODE_EOF))
-#define io_seek(fptr, ofs, whence) (fptr->mode &= ~FMODE_EOF, lseek(flush_before_seek(fptr)->fd, ofs, whence))
+#define io_unset_eof(fptr) (fptr->mode &= ~FMODE_EOF)
+#define io_seek(fptr, ofs, whence) (io_unset_eof(fptr), lseek(flush_before_seek(fptr)->fd, ofs, whence))
#define io_tell(fptr) lseek(flush_before_seek(fptr)->fd, 0, SEEK_CUR)
#ifndef SEEK_CUR
@@ -2868,6 +2869,7 @@ rb_io_ungetbyte(VALUE io, VALUE b)
SafeStringValue(b);
}
io_ungetbyte(b, fptr);
+ io_unset_eof(fptr);
return Qnil;
}
@@ -2924,6 +2926,7 @@ rb_io_ungetc(VALUE io, VALUE c)
else {
io_ungetbyte(c, fptr);
}
+ io_unset_eof(fptr);
return Qnil;
}