diff options
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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 @@ -2845,6 +2846,7 @@ rb_io_ungetbyte(VALUE io, VALUE b) GetOpenFile(io, fptr); rb_io_check_readable(fptr); + io_unset_eof(fptr); if (NIL_P(b)) return Qnil; if (FIXNUM_P(b)) { char cc = FIX2INT(b); @@ -2881,6 +2883,7 @@ rb_io_ungetc(VALUE io, VALUE c) GetOpenFile(io, fptr); rb_io_check_readable(fptr); + io_unset_eof(fptr); if (NIL_P(c)) return Qnil; if (FIXNUM_P(c)) { int cc = FIX2INT(c); |