diff --git a/ChangeLog b/ChangeLog index 7294a2227e..dd387da937 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Jan 21 15:32:15 2009 Nobuyoshi Nakada + + * io.c (rb_io_ungetbyte, rb_io_ungetc): clears EOF flag. + Wed Jan 21 14:41:48 2009 NAKAMURA Usaku * array.c (take_items): to_ary() raises ArgumentError if cannot to 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; }